checkall 发表于 2018-01-31让复选框全部选中和全部取消是比较常用的JavaScript部分:123function checkAll(obj){ $("#box input[type='checkbox']").prop('checked', $(obj).prop('checked'));}html部分:123456789101112<div id="box"> <input type="checkbox" onclick="checkAll(this)">全选<br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br> <input type="checkbox"><br></div>