...

View Full Version : How do I update radio buttons based on a selection from a pull down menu and vice ver



JosephAD
07-14-2004, 12:21 PM
I need a little help on this script. At the moment the dropdown menu's change the radio buttons, but the radio buttons does not change the menu. How can I make this work both ways??



<html>
<head>
<title>Select Radio</title>
</head>

<body>
<form name="my_form">
<input type="radio" name="r" checked>
<input type="radio" name="r">
<input type="radio" name="r">
<input type="radio" name="r">
<br>
<select onchange="this.form.r[this.options
[this.selectedIndex].value].checked=true">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

</form>

</body>
</html>


Thanks in advance!

JPM
07-14-2004, 12:45 PM
<body>
<form name="my_form">
<input type="radio" value="0" name="r" checked onclick="this.form.s[this.value].selected=true">
<input type="radio" value="1" name="r"onclick="this.form.s[this.value].selected=true">
<input type="radio" value="2" name="r"onclick="this.form.s[this.value].selected=true">
<input type="radio" value="3" name="r"onclick="this.form.s[this.value].selected=true">
<br><br>
<select name="s" onchange="this.form.r[this.options
[this.selectedIndex].value].checked=true">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

</form>

</body>
</html>

glenngv
07-15-2004, 04:32 AM
Simpler version:


<input type="radio" value="0" name="r" checked onclick="this.form.s.selectedIndex=this.value">
<input type="radio" value="1" name="r"onclick="this.form.s.selectedIndex=this.value">
<input type="radio" value="2" name="r"onclick="this.form.s.selectedIndex=this.value">
<input type="radio" value="3" name="r"onclick="this.form.s.selectedIndex=this.value">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum