<html>
<head>
<title>Radio</title>
<script language="javascript">
<!--
function RadioCheck() {
var fruit = new Array('Apples', 'Oranges', 'Bananas', 'Kiwis', 'Saskatoons', 'Grapes');
var selection = document.quiz.colour;
for (i=0; i<selection.length; i++)
if (selection[i].checked == true)
alert(fruit[i] + ' are ' + 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>
<input type="radio" name="colour" value="green">green<br>
<input type="radio" name="colour" value="blue">blue<br>
<input type="radio" name="colour" value="purple">purple<br>
<br>
<input type="submit" value="Check Answer" onClick="RadioCheck()">
</form>
</body>
</html>
|