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 Radio button with Select Box

Status
Not open for further replies.

freshnode

Programmer
Dec 4, 2008
1
US
I'm using the following code, and for some reason i can't get it to work. I want it so that when the user Selects South Africa, it disables Flight Option 2. Can someone please help me, I don't see where I'm going wrong...

Header:
<SCRIPT LANGUAGE="JavaScript">

function Disab(val) {
if(val=="Australia")
{document.form1.flight_options[0].disabled=false;document.form1.flight_options[1].disabled=false}
if(val=="New Zealand")
{document.form1.flight_options[0].disabled=false;document.form1.flight_options[1].disabled=false}
if(val=="South Africa")
{document.form1.flight_options[0].disabled=false;document.form1.flight_options[1].disabled=true}
}

</SCRIPT>

Form:
<select name="country" onChange="Disab(this.value)">
<option value="Australia">Australia</option>
<option value="New Zealand">New Zealand</option>
<option value="South Africa">South Africa</option>
</select>

<input type="radio" name="flight_option" value="Option 1" />Flight Option 1

<input type="radio" name="flight_option" value="Option 2" />Flight Option 2
 
>name="flight_option"
>flight_option[red]s[/red][0]
>flight_option[red]s[/red][1]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top