如何给RadioButtonList这些加JS事件。 我有个是否的RadioButtonList点是后旁边出现输入框输入内容。点否隐藏。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用javascript 给RadioButtonList加上onclick事件你说得太含糊 所以没办法给你写代码 是用JS啊。但他生成的HTML是xx_0,xx_1这样的ID.ONCLICK事件放在了外围的SPAN标签上了。就不知道怎么写了。 RadioButtonList1.Items[0].Attributes.Add("onclick","document.getElementById('TextBox1').style.display='none'"); RadioButtonList1.Items[1].Attributes.Add("onclick", "document.getElementById('TextBox1').style.display=''"); thank u RadioButtonList有个BUG就是不能把脚本加到项上,看输出。以前貌似看到过有个什么解决办法的。CS:c31.Attributes.Add("onClick", "tell1(this)");c31.Items[1].Attributes.Add("onClick", "tell(this)");THML:<span id="c31" onClick="tell1(this)"><input id="c31_0" type="radio" name="c31" value="好" checked="checked" /><label for="c31_0">好</label><input id="c31_1" type="radio" name="c31" value="较好" /><label for="c31_1">较好</label><input id="c31_2" type="radio" name="c31" value="一般" /><label for="c31_2">一般</label><input id="c31_3" type="radio" name="c31" value="差" /><label for="c31_3">差</label></span> <script language="javascript" type="text/javascript"> function SetVisible() { var txt = document.getElementById("TextBox1"); var rbl = document.getElementsByName("RadioButtonList1"); for(var i =1;i<rbl.length;i++) { if(rbl[i].checked && rbl[i].value=="1") { txt.style.visibility = "visible"; } if(rbl[i].checked && rbl[i].value=="0") { txt.style.visibility = "hidden"; } } } </script> <asp:RadioButtonList ID="RadioButtonList1" runat="server" onclick="SetVisible()" RepeatDirection="Horizontal"> <asp:ListItem Value="1">是</asp:ListItem> <asp:ListItem Value="0">否</asp:ListItem> </asp:RadioButtonList> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> java httpclient访问asp.net的网站,取不到cookie discuznt 怎么实现回复倒序排列 菜鸟继续发问啊。。。 为什么装了VS2005后没有首页上没有打开网站,只有打开项目.是在哪里还原设置 如何去掉email中的中文而保留英文部分? ASP.NET如何实现多条件的查询语句 求助关于布局安排 请教:用sql语句如何实现下面结果 datagrid中如何做插入新数据? DATAGRID中的EDITITEMTEMPLATE问题,无经验者难答 怎样写 在asp.ent 2.0 中发电子邮件 关于CheckBoxList中SelectedIndexChanged事件的问题
给RadioButtonList加上onclick事件你说得太含糊 所以没办法给你写代码
RadioButtonList1.Items[1].Attributes.Add("onclick", "document.getElementById('TextBox1').style.display=''");
c31.Attributes.Add("onClick", "tell1(this)");
c31.Items[1].Attributes.Add("onClick", "tell(this)");THML:
<span id="c31" onClick="tell1(this)"><input id="c31_0" type="radio" name="c31" value="好" checked="checked" /><label for="c31_0">好</label><input id="c31_1" type="radio" name="c31" value="较好" /><label for="c31_1">较好</label><input id="c31_2" type="radio" name="c31" value="一般" /><label for="c31_2">一般</label><input id="c31_3" type="radio" name="c31" value="差" /><label for="c31_3">差</label></span>
function SetVisible()
{
var txt = document.getElementById("TextBox1");
var rbl = document.getElementsByName("RadioButtonList1");
for(var i =1;i<rbl.length;i++)
{
if(rbl[i].checked && rbl[i].value=="1")
{
txt.style.visibility = "visible";
}
if(rbl[i].checked && rbl[i].value=="0")
{
txt.style.visibility = "hidden";
}
}
}
</script>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" onclick="SetVisible()" RepeatDirection="Horizontal">
<asp:ListItem Value="1">是</asp:ListItem>
<asp:ListItem Value="0">否</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>