PDA

Click to See Complete Forum and Search --> : Drop Down Boxes


Gin_bee
Feb 13th, 2001, 06:51 PM
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!

Mark Sreeves
Feb 14th, 2001, 02:34 AM
This works:



<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>