【 tulaoshi.com - Web开发 】
                             
                            代码如下:
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"/script 
input type="checkbox" name="checkbox_name[]” id=”checkbox_name_1″ /1br / input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_2″ /2br / 
input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_3″ /3br / 
input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_4″ /4br / 
input type=”checkbox” name=”checkedAll” id=”checkedAll”/全选/取消全选 
script type="text/javascript"!-- 
$(function() { 
$("#checkedAll").click(function() { 
if ($(this).attr("checked") == true) { // 全选 
$("input[name='checkbox_name[]']").each(function() { 
$(this).attr("checked", true); 
}); 
} else { // 取消全选 
$("input[name='checkbox_name[]']").each(function() { 
$(this).attr("checked", false); 
}); 
} 
}); 
}); 
// -- 
/script