A
ASM
En réponse à Tamer Higazi qui nous a susurré, en date du : 20/07/07
1:45, le message sibyllin suivant :
I think you have to do a loop on your checboxes
functions checks() {
var f = document.forms[0], c=0, ch=new Array();
for(var i=0; i<f.length; i++) {
if(f.type=='checkbox') {
ch[ch.length] = f.value;
if(f.checked) c++;
}
}
alert('checked checboxes = '+c+'\nvalues = '+ch);
}
1:45, le message sibyllin suivant :
Hi!
I have a form where I have embedded a table. Inside a column in each row
is a checkbox. I want:
A) to get the values of the checkboxes
B) to count the total amount of checkboxes (which are selected)
If somebody can give me an advise, I would thank him7her very much.
I think you have to do a loop on your checboxes
functions checks() {
var f = document.forms[0], c=0, ch=new Array();
for(var i=0; i<f.length; i++) {
if(f.type=='checkbox') {
ch[ch.length] = f.value;
if(f.checked) c++;
}
}
alert('checked checboxes = '+c+'\nvalues = '+ch);
}