function fillCategory(){ // this function is used to fill the category list on load } function SelectSubCat(){ // ON or after selection of category this function will work removeAllOptions(document.drop_list.State); addOption(document.drop_list.State, "-1", "State", ""); // Collect all element of subcategory for various cat_id if(document.drop_list.country.value =='' ){addOption(document.drop_list.State,'1', 'Andhra Pradesh');addOption(document.drop_list.State,'2', 'Tamilnadu');addOption(document.drop_list.State,'3', 'Karnataka');addOption(document.drop_list.State,'4', 'Kerala');addOption(document.drop_list.State,'5', 'Madhya Pradesh');addOption(document.drop_list.State,'6', 'Gujarat');}if(document.drop_list.country.value == '1'){addOption(document.drop_list.State,'1', 'Andhra Pradesh');addOption(document.drop_list.State,'2', 'Tamilnadu');addOption(document.drop_list.State,'3', 'Karnataka');addOption(document.drop_list.State,'4', 'Kerala');addOption(document.drop_list.State,'5', 'Madhya Pradesh');addOption(document.drop_list.State,'6', 'Gujarat');} } function SelectSubCity(){ // ON or after selection of category this function will work removeAllOptions(document.drop_list.city); addOption(document.drop_list.city, "-1", "City", ""); // Collect all element of subcategory for various cat_id if(document.drop_list.State.value == '1'){addOption(document.drop_list.city,'1', 'Hyderabad');addOption(document.drop_list.city,'2', 'Secunderabad');addOption(document.drop_list.city,'3', 'Vizag');addOption(document.drop_list.city,'4', 'Warangal');addOption(document.drop_list.city,'14', 'AS Rao Nagar');addOption(document.drop_list.city,'15', 'ASR Nagar');}if(document.drop_list.State.value == '2'){addOption(document.drop_list.city,'5', 'Chennai');addOption(document.drop_list.city,'6', 'Coimbatore');addOption(document.drop_list.city,'7', 'Salem');addOption(document.drop_list.city,'8', 'Madurai');}if(document.drop_list.State.value == '3'){addOption(document.drop_list.city,'9', 'Bangalore');addOption(document.drop_list.city,'10', 'Mysore');}if(document.drop_list.State.value == '4'){addOption(document.drop_list.city,'11', 'Cochin');addOption(document.drop_list.city,'12', 'Kochi');addOption(document.drop_list.city,'13', 'Trivendram');} addOption(document.drop_list.city, "-2", "Other", ""); } ////////////////// function removeAllOptions(selectbox) { var i; for(i=selectbox.options.length-1;i>=0;i--) { //selectbox.options.remove(i); selectbox.remove(i); } } function addOption(selectbox, value, text ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); }