<html>
<head>
<title>获取单选框的值</title>
<script language="javascript" type="text/javascript">
function test()
{
var commend = theForm.commend.value;
for(var i=0;i<theForm.commend.length;i++)
{
if(theForm.commend[i].checked==true)
{
commend = theForm.commend[i].value;
break;
}
}
alert("单选框的值为:"+commend);
}
</script>
</head>
<body>
<form name="theForm" onsubmit="test()">
<input type="radio" name="commend" value="1">正确
<input type="radio" name="commend" value="0">错误
<input type="submit" >
</form>
</body>
</html>