<html>
<body>
1<input type='radio' name='apradio' value='1' onclick='which("apradio")'><br>
2<input type='radio' name='apradio' value='2'
onclick='which("apradio")'><br>
3<input type='radio' name='apradio' value='3'
onclick='which("apradio")'><br>
4<input type='radio' name='apradio' value='4' onclick='which("apradio")'><br>
<script type='text/javascript'>
function which( name ) {
var radio = document.getElementsByName( name );
var result = 'None';
for ( var i = 0; i < radio.length; i++ ) {
if ( radio[ i ].checked ) {
result = radio[ i ].value;
}
}
alert( result );
}
</script>
</body>
</html>
|