<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="form" onsubmit="test()"> <input type="radio" name="commend" value="1">正确 <input type="radio" name="commend" value="0">错误 <input type="submit" ></form></body></html> 如果是已知的单选框的顺序,那就可以直接用radio[i].value来获取它的值,而不用循环了。