中继器中的复选框

编程入门 行业动态 更新时间:2024-10-18 16:52:14
本文介绍了中继器中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨...我的问题是,当用户单击第一个复选框时,单选按钮显示,但不幸的是第二个按钮显示,其余按钮不起作用. 这是我的代码: Javascript:

Hi... my problems is when user click on the first check box the radio buttons shows but unfortunately for the second button and the rest its doesn''t work. here is my code: Javascript :

function Check() { var id =document.getElementById("Id").value; if(document.getElementById("Chck"+id).checked==true) { document.getElementById("NA"+id).style.display = "none"; ; } else { document.getElementById("NA"+id).style.display = "block"; } }

而对于我的html代码:

and for my html code:

<asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <tr> <td> <input id="Chck<%=Id%>" type="checkbox" name="chkBox" onclick="Check()"/> <input id="Id" type="hidden"value="<%=Id%>" /> </td> <td> <input type="radio" name="Rb_p" value="Play only" title="Play only">Play Only</radio> &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="Rb_pn" value="Play" title="Play">Play & Sing</radio> </div> <div id="NA<%=Id%>" class="style4" > &nbsp;&nbsp;<input type="text" name="P1" value="<%=P1 %>" style="border: 0px" readonly="readonly"> </div> </td> </tr> </ItemTemplate> </asp:Repeater

>

>

推荐答案

可能在"Chck" + id中存在问题.查看源代码页并找到复选框的客户端ID ... 另外,您可以通过使用alert(id);测试代码.在您的javascript中. might there is problem in "Chck"+id. View source code page and find the client ids of check box... Also, you can test the code by using alert(id); in your javascript.

更多推荐

中继器中的复选框

本文发布于:2023-11-25 01:56:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627839.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:复选框   器中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!