helo,
i want to select all checkboxes by using javascript my code is as follows
<script language ="javascript" type="text/javascript">
function checkbox1(chcontrol, state)
{
var chkbx1=document.getElementById(chcontrol);
var chkBoxCount=chkbx1.getElementsByTagName("input");
for(var i=0;i<chkBoxCount.length;i++)
{
chkBoxCount[i].checked = state;
}
return false;
}
</script>
select<a id="chk1" href="#" onclick="javascript:checkbox1('<%=CheckBoxList1.ClientID%>', true)">All</a>|<a id="chk2" href="#" onclick="javascript:checkbox1('<%=CheckBoxList1.ClientID%>', false)">None</a> this code is working fine with anchor tags when i call my function from this tag,
but it is not working when i call the javascript function from checkbox like in this way <asp:CheckBox ID="CheckBox1" runat="server" Text="Select All" oncheckedchanged="javascript:checkbox1('<%=CheckBoxList1.ClientID%>', true)" /><br />
please help