| Subcribe via RSS

checkbox select all function

February 7th, 2008 | 1 Comment | Posted in javascript by dreamluverz

I created some function for selectall checkbox. It works coz i’ve been using this.



obj_chkall - is the object of the checkbox that when you click will check all other checkboxes usually on mails
chkbox_name - is the name of the field of the checkboxes

function dps_chkall(obj_chkall, chkbox_name){
var form_name = obj_chkall.form;

if(typeof(chkbox_name) == 'object'){
obj_chkall.checked = false;
}else{
for(var d = 0; d < form_name.elements.length; d++){
if(form_name.elements[d].name == chkbox_name){
form_name.elements[d].checked = obj_chkall.checked;
}
}
}
}

Tags: , ,