function invertAll(field)

// Invert all selections of a checkbox within a form,
// just pass it the name of the checkbox field
// e.g. onClick="invertAll(document.frmTest.checkboxName)";

{
if (typeof(field.length) == "undefined")

{
if(field.checked == 1){field.checked = 0;}
else {field.checked = 1;}

}
for (i = 0; i < field.length; i++) { if(field[i].checked == 1){field[i].checked = 0;} else {field[i].checked = 1;} } }

How to invert all checkboxes on a form

Leave a Reply

Your email address will not be published. Required fields are marked *

3 + one =