Get the select radio button and its value : RadioButton Radio « Form Control « JavaScript DHTML






Get the select radio button and its value

   


<html>
<head>
<script>
function processSize(){
  var size;
  var i;
  var selectedOne;
  for (i = 0; i <= 3; i++){
    selectedOne = document.myForm.radSize[i];
    if (selectedOne.checked == true){
      size = selectedOne.value;
    }
  }
  document.myForm.txtOutput.value = size;
}
</script>
</head>
<body>
<form name = myForm>
<input type = "radio" name = radSize value = "small">Small
<input type = "radio" name = radSize value = "medium">Medium
<input type = "radio" name = radSize value = "large">Large
<input type = "button" value = "OK" onClick = "processSize()">
<textarea name = "txtOutput" rows = 5 cols = 40>
</textarea>
</form>
</body>
</html>

   
    
    
  








Related examples in the same category

1.'defaultChecked' Example
2.Radio Button status Example
3.Check a Radio Button
4.Radio buttons in a form
5.Using the onPropertyChange Property
6.Radio action
7.Methods and Properties of the Radio Object
8.Determining the Value of the Selected Radio Button
9.Scripting a Group of Radio Objects
10.Finding the Selected Button in a Radio Group
11.An onClick event Handler for Radio Buttons
12.Get the radio button selection
13.Cycle the selected radio buttons