中继器中的复选框 [英] Checkbox in repeater
本文介绍了中继器中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨...我的问题是,当用户单击第一个复选框时,单选按钮显示,但不幸的是第二个按钮显示,其余按钮不起作用.
这是我的代码:
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> <input type="radio" name="Rb_pn" value="Play"
title="Play">Play & Sing</radio>
</div>
<div id="NA<%=Id%>" class="style4" >
<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.
这篇关于中继器中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文