S
Sjoerd
Hi all,
I have a form on which users can check several boxes. Long time ago I
added some javascript from another site to check all the boxes in one
column. I now found out that with more than ten columns, it doesn't
work: it seems that in case I check the 14th column, it checks the
first and the fourth also. Can anyone tell me how to change the code so
that it might work correctly?
function checkAll(theForm, cName, allNo_stat) {
var n=theForm.elements.length;
for (var i=0;i<n;i++){
if
(theForm.elements.className.indexOf(cName) !=-1){
if (allNo_stat.checked) {
theForm.elements.checked = true;
} else {
theForm.elements.checked = false;
}
}
}
}
In the table, above all columns I put this:
<input type='checkbox'
onclick=\"checkAll(document.getElementById('formname'), '{Number of
Column}',this);\" >
Thanks in advance for your help,
Sjoerd Mulder
I have a form on which users can check several boxes. Long time ago I
added some javascript from another site to check all the boxes in one
column. I now found out that with more than ten columns, it doesn't
work: it seems that in case I check the 14th column, it checks the
first and the fourth also. Can anyone tell me how to change the code so
that it might work correctly?
function checkAll(theForm, cName, allNo_stat) {
var n=theForm.elements.length;
for (var i=0;i<n;i++){
if
(theForm.elements.className.indexOf(cName) !=-1){
if (allNo_stat.checked) {
theForm.elements.checked = true;
} else {
theForm.elements.checked = false;
}
}
}
}
In the table, above all columns I put this:
<input type='checkbox'
onclick=\"checkAll(document.getElementById('formname'), '{Number of
Column}',this);\" >
Thanks in advance for your help,
Sjoerd Mulder