|
-
May 9th, 2005, 09:27 AM
#1
Thread Starter
Lively Member
[resolved] Change value of radio button by clicking on select?
Hello all.
How would I select a specific radio button in an array by selecting an option within a select?
Code:
<input type="radio" name="avatar" value="gallery_avatar">
<input type="radio" name="avatar" value="upload_avatar">
<select name="gallery">
<option value="Bender.jpg">Bender</option>
<option value="Homer.jpg">Homer</option>
</select>
<!--
What I mean is when a user selects one of the options above, I would like to check the first radio button.
-->
Any help is appreciated.
Last edited by solitario; May 27th, 2005 at 02:53 PM.
-
May 9th, 2005, 09:42 AM
#2
Re: Change value of radio button by clicking on select?
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<script>
function changeoption()
{
var frm = document.frm;
frm.avatar[frm.sel.options.value].checked = "true";
}
</script>
</head>
<body>
<form name="frm">
<input type="radio" name="avatar" checked="true">
<input type="radio" name="avatar">
<input type="radio" name="avatar">
<br>
<select name="sel" onchange="changeoption()">
<option value=0>One</option>
<option value=1>Two</option>
<option value=2>three</option>
</select>
</form>
</body>
</html>
-
May 9th, 2005, 12:08 PM
#3
Thread Starter
Lively Member
Re: Change value of radio button by clicking on select?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|