单选框的值取不到,不知道为什么

来源:百度知道 编辑:UC知道 时间:2024/06/26 06:11:06
单选框的值取不到,不知道为什么

daotu = rs("daotu")
<td><Input Type="radio" name="dao_name" value="<%=daotu%>" onclick="alert(this.value);></td> //在这里弹出框可以取得

==========================
获取radio值并执行,没有取得radio值
fuction good()

dim name
name = request.form("dao_name")
response.write ("<script>alert('" + name + "')</script>")
cmd.CommandText = "yponguou"
cmd.Execute,array(a,name)

end function
四楼 谢谢你 你能帮我改成RadioButton服务器控件吗?我不会RadioButton服务器控件,完整代码如下
select han
Case "qqload"
good()

fuction good()
dim name
name = request.form("dao_name")
response.write ("<script>alert('" + name + "')</script>")
cmd.CommandText = "yponguou"
cmd.Execute,array(a,name)
end fun

你的radio在form里,并且有submit按钮吗?比如:
<form action="default.aspx" method="post" name="frm">
<input type="radio" name="dao_name" value="<%=daotu%>" onclick="alert(this.value);" />
<input type="submit" />
浏览器中按submit按钮后,然后在default.aspx中才可以访问Request.Form["dao_name"]
其实这不是ASP.NET的风格,应该用服务器控件RadioButton
********************************************
Sorry!我写错了,是RadioButton ,不是RadioBox
我的意思是:
看到你代码中radio标记的value是用服务器代码取得的,而且还要传递值回服务器,并不是完全在客户端工作。
所以,直接放上一个RadioButton服务器控件,设置为AutoPostBack,在CheckedChanged事件中编写cmd.CommandText = "yponguou"
cmd.Execute,array(a,name) 等代码。
利用事件机制,才是ASP.NET的风格。

你下面写的是一个function good(),这是函数
而没有看到你调用,那就是没执行呀

再加上一句
Call good()
就可以了

在.net 编成环境下Input是可以转换为服务器控件使用的,在input控件上点右键,选择作为服务器控件
转为服务器控件后,我想你现在这个问题应该就解决了