function SelectBld(){ removeAllOptions(document.foSave.slBuildingID); removeAllOptions(document.foSave.slBuildingSubID); addOption(document.foSave.slBuildingID, "", "Select building", ""); switch(document.foSave.slStreetID.value) { case '1': addOption(document.foSave.slBuildingID,"1157","Mike Test 1 - Chestnut Road North Side"); addOption(document.foSave.slBuildingID,"1161","Building - High Street North Side"); addOption(document.foSave.slBuildingID,"1158","Testing 123"); break; case '2': break; case '3': break; case '8': break; case '9': addOption(document.foSave.slBuildingID,"1160","Mike Test 1 - Chestnut Road North Side"); addOption(document.foSave.slBuildingID,"1159","Mike Test 1 - Chestnut Road North Side"); break; case '19': break; case '12': addOption(document.foSave.slBuildingID,"1162","8 Mount Pleasant"); addOption(document.foSave.slBuildingID,"1163","9 Mount Pleasant"); addOption(document.foSave.slBuildingID,"1164","10 Mount Pleasant"); addOption(document.foSave.slBuildingID,"1167","12 Mount Pleasant"); addOption(document.foSave.slBuildingID,"1168","13 Mount Pleasant"); addOption(document.foSave.slBuildingID,"1165","11 Mount Pleasant"); break; case '13': break; case '14': break; case '6': break; case '7': break; case '4': break; case '5': break; case '10': break; case '11': break; case '15': break; case '21': addOption(document.foSave.slBuildingID,"1166","Big House On the Mall"); break; } // end of JS switch } // end of JS function SelectBld() function SelectHeredit(){ removeAllOptions(document.foSave.slBuildingSubID); switch(document.foSave.slBuildingID.value) { case '1157': addOption(document.foSave.slBuildingSubID,"1","whole building"); break; case '1166': addOption(document.foSave.slBuildingSubID,"10","whole building"); break; case '1161': addOption(document.foSave.slBuildingSubID,"5","whole building"); break; case '1162': addOption(document.foSave.slBuildingSubID,"12","Sub B"); addOption(document.foSave.slBuildingSubID,"11","Sub A"); break; case '1163': addOption(document.foSave.slBuildingSubID,"7","whole building"); break; case '1160': addOption(document.foSave.slBuildingSubID,"4","whole building"); break; case '1159': addOption(document.foSave.slBuildingSubID,"3","whole building"); break; case '1164': addOption(document.foSave.slBuildingSubID,"8","whole building"); break; case '1158': addOption(document.foSave.slBuildingSubID,"2","whole building"); break; case '1167': addOption(document.foSave.slBuildingSubID,"13","whole building"); break; case '1168': addOption(document.foSave.slBuildingSubID,"14","whole building"); break; case '1165': addOption(document.foSave.slBuildingSubID,"9","whole building"); break; } // end of JS switch } // end of JS function SelectHeredit() 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); }