I have two drop down boxes on the same form that both contain two options, Yes/No. I want the second box to default to No if No is selected from the first Drop down box. I'm assuming that i can do this in Javascript but I'm not sure how!
Printable View
I have two drop down boxes on the same form that both contain two options, Yes/No. I want the second box to default to No if No is selected from the first Drop down box. I'm assuming that i can do this in Javascript but I'm not sure how!
This works:
Code:
<HTML>
<HEAD>
<script language=javascript>
function doit(x)
{
if(x==0)
{
document.frm1.s2.selectedIndex=0;
}
}
</script>
</HEAD>
<BODY>
<form name="frm1">
<select name="s1" onclick="doit(this.selectedIndex)">
<option value=0>No</option>
<option value=1>Yes</option>
</select>
<select name="s2">
<option value=0>No</option>
<option value=1>Yes</option>
</select>
</form>
</BODY>
</HTML>