<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><body >
<script>
function test(){
var radioN=f1.elements;
var a= radioN.length;
for(var i=0;i<radioN.length;i++){
if(radioN[i].type=="radio"&&radioN[i].checked==true){
alert("选中的radio的值为"+radioN[i].value);
}
}
}
</script><form name="f1" action="" method="post" onclick="test();">
<input type="radio" name=a checked value=0>
<input type="radio" name=a value=1>
<input type="radio" name=a value=2>
</form>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><body >
<script>
function test(){
var radioN=f1.elements;
var a= radioN.length;
for(var i=0;i<radioN.length;i++){
if(radioN[i].type=="radio"&&radioN[i].checked==true){
alert("选中的radio的值为"+radioN[i].value);
}
}
}
</script><form name="f1" action="" method="post" onclick="test();">
<input type="radio" name=a checked value=0>
<input type="radio" name=a value=1>
<input type="radio" name=a value=2>
</form>
</BODY>
</HTML>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function pc(objsex){
alert(objsex.value);
}
</script>
</head>
<body><form name="myForm">
<FONT face="宋体">性别:</FONT>
<INPUT id="Radio1" type="radio" value="男" name="mySex" onclick="pc(this)">
<FONT face="宋体">男</FONT>
<INPUT id="Radio2" type="radio" value="女" name="mySex" onclick="pc(this)">
<FONT face="宋体">女</FONT>
</form>
</body>
</html>
{
var value = null;
for( var i = 0 ; i < radioObject.length ; i++ )
{
if( radioObject[i].checked )
{
value = radioObject[i].value;
break
}
}
return value;
}
<input type="radio" name=a value=1 id=a2>
<input type="radio" name=a value=2 id=a3>
<script>
for(i=1;i<4;i++)
alert(eval("a"+i).value)
</script>