[Javascript] Re: Javascript probem in HTML Form
Shawn Milo
milo at linuxmail.org
Fri May 21 07:39:32 CDT 2004
I modified your style to my own readability preferences. Hope you don't mind.
Shawn
Try this:
<html>
<head>
<script type="text/javascript">
function on_load(){
var returnVal = location.search.replace(/^\?rd=(.*)$/, '$1');
if(returnVal != ''){
if(returnVal == "FOOT"){
form1.rd[0].checked=true;
}
if(returnVal == "CRIC"){
form1.rd[1].checked=true;
}
}
}
</script>
</head>
<body>
<form name="form1">
<input type="radio" name="rd" value="FOOT"/>Football
<br />
<input type="radio" name="rd" value="CRIC"/> Cricket
<input type="submit" value="Submit" id="btnSubmit" />
</form>
<script type="text/javascript">
on_load()
</script>
</body>
</html>
More information about the Javascript
mailing list