<html>
<body>
<form>
<input type="radio" id="radio1" name="radio1" value="a" onclick="test(this)"/>
<input type="radio" id="radio1" name="radio1" value="b" checked onclick="test(this)"/>
<input type="button" onclick="test()">
<input type="button" onclick="test2()">
</form>
<p>The name of the radio button is:
<script type="text/javascript">
function test(obj){
alert(obj.value);
}
function test2(){
var x = document.getElementsByName('radio1');
for(i=0;i<x.length;i++){
if(x[i].checked){
alert(x[i].value)
}
}
}
</script></p>
</body>
</html>