2008-01-07 21:38:49 +01:00
|
|
|
function checkAll(form) {
|
|
|
|
for (i = 0, n = form.elements.length; i < n; i++) {
|
2008-03-18 03:04:54 +01:00
|
|
|
if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
|
|
|
|
if(form.elements[i].checked == true)
|
|
|
|
form.elements[i].checked = false;
|
|
|
|
else
|
|
|
|
form.elements[i].checked = true;
|
2008-01-07 21:38:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getNumChecked(form) {
|
|
|
|
var num = 0;
|
|
|
|
for (i = 0, n = form.elements.length; i < n; i++) {
|
|
|
|
if (form.elements[i].type == "checkbox") {
|
2008-03-02 21:17:30 +01:00
|
|
|
if (form.elements[i].checked == true)
|
|
|
|
num++;
|
2008-01-07 21:38:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkAllUsers(role) {
|
|
|
|
var checkboxs = document.getElementsByTagName('input');
|
2008-03-02 21:17:30 +01:00
|
|
|
for(var i = 0, inp; inp = checkboxs[i]; i++)
|
|
|
|
if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
|
2008-01-07 21:38:49 +01:00
|
|
|
if(inp.checked == false)
|
|
|
|
inp.checked = true;
|
|
|
|
else
|
|
|
|
inp.checked = false;
|
|
|
|
}
|