Results 1 to 2 of 2

Thread: Drop Down Boxes

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39

    Exclamation

    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!

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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>
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width