热门文章 | 热门软件| 热门源码 | 热门电影 | 知识库 | 联系我们
软件 源码 教程 影视 健康 招聘
  HTML | JavaScript | ASP | PHP | JSP | NET | VB | VC | VF | Windows | Linux | Mysql | Mssql | Oracle | Struts 
当前位置: 创世纪计算机资源网 -> 文章频道 ->js 
站内搜索:
用js获取单选框的值
作者:佚名 来源:互联网 整理日期:2008-4-22

<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>

 

相关文章
暂无