Jump to content

Halfway home... Making disabled SELECT option become active


galvin

Recommended Posts

I think I am close, but need some help to finish.  It the HEAD of  my page, I have...

 

<script language="javascript">
function enableField()
{
document.getElementById("ounces").disabled=false;
}
</script>

 

Then further down, I have these two select fields in a form...

 

 

 

<td> <select name='pounds'><option value='0'>Choose Pounds</option>  
<option value='4'>LESS THAN 5 pounds</option> 
<option value='5'>5 pounds</option> 
<option value='6'>6 pounds</option> 
<option value='7' selected='selected'>7 pounds</option> 
<option value='8'>8 pounds</option> 
<option value='9'>9 pounds</option> 
<option value='10'>10 pounds</option> 
<option value='11'>11 pounds</option> 
<option value='12'>MORE THAN 11 pounds</option> 
</select>
</td><td> <select name='ounces' id='ounces' disabled='true'>    <option value='0'>Choose Ounces</option> 
<option value='0' selected='selected'>0 ounces </option> 
<option value='1'>1 ounces </option> 
<option value='2'>2 ounces </option> 
<option value='3'>3 ounces </option> 
<option value='4'>4 ounces </option> 
<option value='5'>5 ounces </option> 
<option value='6'>6 ounces </option> 
<option value='7'>7 ounces </option> 
<option value='8'>8 ounces </option> 
<option value='9'>9 ounces </option> 
<option value='10'>10 ounces </option> 
<option value='11'>11 ounces </option> 
<option value='12'>12 ounces </option> 
<option value='13'>13 ounces </option> 
<option value='14'>14 ounces </option> 
<option value='15'>15 ounces </option> 
</select>
</td>

 

How can I make it so the "ounces" select option gets set to "disabled=false" (i.e. becomes ACTIVE) when the visitor chooses any of the "Pound" values between 5 and 11.

 

Basically, when the page is loaded, the ounces dropdown is INACTVE.  If they choose either "LESS THAN 5 POUNDS" or "MORE THAN 11 POUNDS", there is no reason to select ounces, so it stays disabled.  but if they choose any of the other pound values, I need ounces to become an ACTIVE option so they can select ounces too.

 

Any ideas?

 

Greg

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.