Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable and enable drop down

Status
Not open for further replies.

cleanair4me

Technical User
May 16, 2008
61
I have 2 drop downs where I want the second one to be disabled. It will only be enabled after the first drop down has been selected.

Here is my attempt but not working because the second drop down is always enabled:
Code:
<script>
function enableField()
{
if(document.myname.movie.value != "")
{
   document.myname.television.disabled=true;
}
}
</script>


<form name="myname" method="post" action="page.jsp">
<select name = "Movie" onselect="enableField()";>
<option value = "">Select One</option>
<option value = "I am Legend">I am Legend</option>
<option value = "Wedding Crashers">Wedding Crashers</option>
<option value = "Jaws">Jaws</option>
</select>

<select name = "Television">
<option value = "">Select One</option>
<option value = "CSI">CSI</option>
<option value = "Amercian Idol">American Idol</option>
<option value = "60 Minutes">60 Minutes</option>
</select>
 
Well, it would be helpful to disable the 2nd drop down by default first ;)

Code:
<select name = "Television" disabled="disabled">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top