Well that's generally not so difficult and works something like this:
Code:
function countCheckboxes() {
var total = 0;
var max = form.element.length;
for (var i=0; i<max; i++) {
if (eval("document.form.element[" + i + "].checked") == true) {
total += 1;
}
}
alert(total + " checkboxes have been selected.");
}
... and the countCheckboxes() function is then called onclick at the submit button.
But: this only works if more than one checkbox exists in the HTML source.
The "length" object returns "undefined" if there's only one checkbox! And the counting function doesn't work anymore.
Had anybody ever to deal with this problem and knows about a solution or a workaround?