Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Check all boxes :: JS howto?


moonbiter - 4:50 pm on Aug 20, 2002 (gmt 0)


You could also do something similar to #2 like this in DOM browsers:

function selectAll(obj) {
var checkBoxes = document.getElementsByTagName('input');
for (i = 0; i < checkBoxes.length; i++) {
if (obj.checked == true) {
checkBoxes[i].checked = true; // this checks all the boxes
} else {
checkBoxes[i].checked = false; // this unchecks all the boxes
}
}
}

and call it like this:

selectAll(this);


Thread source:: http://www.webmasterworld.com/javascript/174.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com