I am trying to set a particular radio button’s checked value when the page loads (based on server side information) here’s the code:
[CODE]
<html>
<head>
<script type=”text/javascript”>
var what=”one”;
switch(what)
{
case “one”:
document.send.group1[0].checked = true;
document.send.group1[1].checked = false;
document.send.group1[2].checked = false;
break;
case “two”:
document.send.group1[0].checked = false;
document.send.group1[1].checked = true;
document.send.group1[2].checked = false;
break;
case “three”:
document.send.group1[0].checked = false;
document.send.group1[1].checked = false;
document.send.group1[2].checked = true;
break;
default:
document.send.group1[0].checked = true;
document.send.group1[1].checked = false;
document.send.group1[2].checked = false;
}
</script>
</head>
<body>
<form name=”send” action=”send.php” method=”post”>
<input type=”radio” name=”group1″ value=”1″ />
Radio 1<br />
<input type=”radio” name=”group1″ value=”2″ />
Radio 2 <br />
<input ” type=”radio” name=”group1″ value=”3″ />
Radio 3<br />
<input type=”submit” value=”Submit” /><br />
</form>
</body>
</html>