Wordpress/wp-admin/js/forms.js
Ryan Boren 6d7441c26e Remove trailing whites.
git-svn-id: https://develop.svn.wordpress.org/trunk@7130 602fd350-edb4-49c9-b593-d223f7449a82
2008-03-02 20:17:30 +00:00

31 lines
809 B
JavaScript

function checkAll(form) {
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox" && !(form.elements[i].hasAttribute('onclick'))) {
if(form.elements[i].checked == true)
form.elements[i].checked = false;
else
form.elements[i].checked = true;
}
}
}
function getNumChecked(form) {
var num = 0;
for (i = 0, n = form.elements.length; i < n; i++) {
if (form.elements[i].type == "checkbox") {
if (form.elements[i].checked == true)
num++;
}
}
return num;
}
function checkAllUsers(role) {
var checkboxs = document.getElementsByTagName('input');
for(var i = 0, inp; inp = checkboxs[i]; i++)
if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
if(inp.checked == false)
inp.checked = true;
else
inp.checked = false;
}