function selectAll(checkBoxName){ var elms = document.getElementsByName(checkBoxName); if (elms.length<1) return; var allChecked = true; for (var i=0;i if (elms[i].type=="checkbox") allChecked &= elms[i].checked; for (var i=0;i if (elms[i].type=="checkbox"){ elms[i].checked = !allChecked; if (elms[i].onclick) elms[i].onclick(); } } ---------------------------------------------------------------