Hi Techies,
I am creating check boxes in a for loop.
Here is my code.
<%
Iterato kkIterator = ruleList.iterator();
while(kkIterator.hasNext())
{
String kkName = kkIterator.next().toString();
%>
<input type=”checkbox” name=”kkCheckBoxes” value =”<%=kkName%>” ><%=kkName %>
<%
}
%>
I want to put one option like checkAll and deselectCheckBoxes. I check checkAll check box , all the check boxes should be checked.
If i check Deselect, the all the check boxes should be unchecked.
How can I do this one??
regards,
Krish
The java script I am writting is
function selectAll(){
if(frm.checkAll.checked){
if(!frm.kkCheckBoxes[0]){//single check-box
frm.check_StudentId.checked = true;
}
else{//array of check-boxes
for(var i=0; i<frm.kkCheckBoxes.length; i++){
frm.kkCheckBoxes[i].checked = true;
}
}
}
else{
if(!frm.kkCheckBoxes[0]) { // single check-box
frm.kkCheckBoxes.checked = false;
}
else{//array of check-boxes
for(var i=0; i><frm.kkCheckBoxes.length; i++) {
frm.kkCheckBoxes[i].checked = false;
}
}
}
}
But this script I am getting error Object expected.
Can u guys tell me am i missing some thing in my code
regards,
krish