<input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_1″ />1<br /> <input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_2″ />2<br /> <input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_3″ />3<br /> <input type=”checkbox” name=”checkbox_name[]” id=”checkbox_name_4″ />4<br /> <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>