//checks all checkboxes function checkAll(field) { if (!(field.length)) { field.checked = true; } else { for (var i = 0; i < field.length; i++) { field[i].checked = true; } } } //unchecks all checkboxes function uncheckAll(field) { if (!(field.length)) { field.checked = false; } else { for (var i = 0; i < field.length; i++) { field[i].checked = false; } } } select / deselect all loop through all checkboxes in a form: function checkAll() { for (i=0; i