<script language="javascript"> <!-- function RadioCheck() { var selection = document.quiz.radio; for (i=0; i<selection.length; i++) if (selection[i].checked == true) alert(selection[i].value) } //--> </script>
<form name="quiz"> <input type="radio" name="radio" value="red">red<br> <input type="radio" name="radio" value="orange">orange<br> <input type="radio" name="radio" value="yellow">yellow<br>
<input type="submit" value="Check Answer" onClick="RadioCheck()"> </form>
Window.Location
Window.Open
<script language="javascript"> <!-- function RadioCheck() { var selection = document.quiz.radio; for (i=0; i<selection.length; i++) if (selection[i].checked == true) window.location = "http://www.google.com/"; } //--> </script>
false
<script language="javascript"> <!-- function RadioCheck() { var selection = document.quiz.radio, urls = [ 'http://www.google.com/', 'http://www.bing.com/', 'http://yahoo.com/' ]; for (i=0; i<selection.length; i++) if (selection[i].checked) window.location = urls[i]; return false; // ADD THIS! } //--> </script>
return
<input type="submit" value="Check Answer" onClick="return RadioCheck()">
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)