Entry
How to show or hide a select box depending on the options selected in another select box?
Aug 11th, 2006 16:11
David Alden, sanjeev kulkarni,
<html>
<script type="text/javascript" language="javascript">
function changeSelectBox(){
var changedValue=document.thisForm.thisSelect.value;
if(changedValue == 1){
document.thisForm.secondSelect.disabled=true;
} else if(changedValue == 2){
document.thisForm.secondSelect.disabled=false;
}
}
</script>
<form name="thisForm">
<select name="thisSelect" onchange="changeSelectBox()">
<option value="1">hide 2nd select box</option>
<option value="2">show 2nd select box</option>
</select>
<select name="secondSelect" disabled="true">
<option value="0">please select an
option</option>
</select>
</form>
</html>