<html>
<head>
<script language = "JavaScript">
function getRadioValue(radioObject) {
var value = null
for (var i=0; i<radioObject.length; i++) {
if (radioObject[i].checked) {
value = radioObject[i].value;
break ;
}
}
return value
}
</script>
</head>
<body>
<form name="form1">
<p><input type=radio name="songs" value="A">A</p>
<p><input type=radio name="songs" value="B">B</p>
<p><input type=radio name="songs" value="C">C</p>
<input type=button value="Show Selected" onClick="alert(getRadioValue(this.form.songs))">
</form>
</body>
</html>
|