如何得到单选按钮的值?

qiushuiw 2004-02-03 12:40:33
如何得到单选按钮的值?
document.form1.radiobutton.value
这样好象不行!
...全文
68 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qiushuiw 2004-02-03
  • 打赏
  • 举报
回复
急!!!
51windows 2004-02-03
  • 打赏
  • 举报
回复
http://www.51windows.net/myfile/js/radio.htm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Author" content="海娃,haiwa">
<meta name="keywords" content="51windows.Net asp creater">

<title></title>
</head>
<body>

<SCRIPT LANGUAGE="JavaScript">
function chkform()
{
var i=0;
var select = false
var obj = form.name
for(i=0 ;i<obj.length;i++)
{
if(obj[i].checked)
{
alert(obj[i].value);
select = true;
}
}
if (!select){alert("没有选择")}
}
</SCRIPT>

<form method="POST" name="form" >
<input class="checkbox" id="name0" type="radio" name="name" value="博士"><label for="name0">博士</label>
<input class="checkbox" id="name1" type="radio" name="name" value="硕士"><label for="name1">硕士</label>
<input class="checkbox" id="name2" type="radio" name="name" value="本科"><label for="name2">本科</label>
<input class="checkbox" id="name3" type="radio" name="name" value="大专"><label for="name3">大专</label>
<input class="checkbox" id="name4" type="radio" name="name" value="中专"><label for="name4">中专</label>
<input class="checkbox" id="name5" type="radio" name="name" value="中技"><label for="name5">中技</label>
<input class="checkbox" id="name6" type="radio" name="name" value="高中"><label for="name6">高中</label>
<input class="checkbox" id="name7" type="radio" name="name" value="初中"><label for="name7">初中</label>
<input class="checkbox" id="name8" type="radio" name="name" value="小学"><label for="name8">小学</label>
<input type="button" onclick='chkform();' value="确 定" class=button> <input type="reset" value="重 置" class=button>
</form>
<p align="center"><a href="http://www.51windows.net">http://www.51windows.net</a></p>
</body>
</html>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧