Can somebody show me how to check all checkboxes in a form with JavaScript? Like in Hotmail, you've got that "Check All" checkbox at the top of the Inbox.
Thanks
:)
Printable View
Can somebody show me how to check all checkboxes in a form with JavaScript? Like in Hotmail, you've got that "Check All" checkbox at the top of the Inbox.
Thanks
:)
From our very own John Percival :D:
Of course you have to name your INPUT fields appropriately. :)Code:function CheckAll() {
for (var i=0;i<document.form.elements.length;i++) {
var e = document.form.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox')) {
e.checked = document.form.allbox.checked;
}
}
}
Thanks Arien, I take back all but 4 bad things I've said about you. (I need to keep some in reserve:D)
:)
Thanks, I guess. :)