One easy JavaScript function that will check or uncheck all the checkboxes in a form that's being passed as the first argument to the function.
- // To check all: CheckUncheckAll(‘myFormId’, true);
- // To uncheck all: CheckUncheckAll(‘myFormId’, false);
- function CheckUncheckAll(formID, checkAll)
- {
- var currForm = document.getElementById(formID);
- for (var i = 0; i < currForm.elements.length; i++)
- {
- currForm.elements[i].checked = checkAll;
- }
- }