Get the radio button selection : RadioButton Radio : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » RadioButton Radio »

 

Get the radio button selection





<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>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» RadioButton Radio