呵呵!记一段脚本放这里,在之前的项目中有用到。 代码如下: <script type="text/javascript"> function chkSelectAll(spanckb) { var thebox = spanckb; oState = thebox.checked; oItem = thebox.form.elements; for(i=0;i<oItem.length;i++) { if(oItem[i].type=="checkbox" & oItem[i].id!=thebox.id) { if(oItem[i].checked!=oState) oItem[i].click(); } } } </script> 转载于:https://www.cnblogs.com/sunming0905/archive/2007/01/29/632984.html