in click event it will work....
function myfn() {
var dlist = document.getElementById("CheckBoxList1");
var count = dlist.cells.length;
for (var i = 0; i < count; i++) {
var cId = "CheckBoxList1_" + i;
var cbox = document.getElementById(cId);
if (cbox.checked == true) {
alert("ok");
}
}
}
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
onclick="myfn()">
<asp:ListItem>one</asp:ListItem>
<asp:ListItem>two</asp:ListItem>
<asp:ListItem>three</asp:ListItem>
<asp:ListItem>four</asp:ListItem>
</asp:CheckBoxList>
this is working for me..