I have the following coded radio buttons, which retrieve value(s) in the code below.
Is it possible to create hyperlink references from these retrieved values e.g., google.com and/or yahoo.com for the selected radio buttons?
<script language="javascript">
<!--
function RadioCheck() {
var selection = document.quiz.colour;
for (i=0; i<selection.length; i++)
if (selection[i].checked == true)
alert(selection[i].value);
}
//-->
</script>
</head>
<body>
<form name="quiz">
<input type="radio" name="colour" value="red">red<br>
<input type="radio" name="colour" value="orange">orange<br>
<input type="radio" name="colour" value="yellow">yellow<br>
<br>
<input type="submit" value="Check Answer" onClick="RadioCheck()">
</form>
thanks in advance.
I’m not sure if ‘red’ should redirect to Google, but in case you’d like this, code along the lines of:
and then in JavaScript:
So instead of alerting the value, you navigate to the value, which has been set to some website.
You would also need to cancel the real submitting: http://jsfiddle.net/HDL7J/.