$(function(){
$("#checkAll").click(function(){
$("input[type='checkbox']").prop("checked",$("#checkAll").is(':checked'));
})
})
<table border="1">
<tr><td><input type="checkbox" id="checkAll" /> 全选</td></tr>
<tr><td><input type="checkbox" /> 1</td></tr>
<tr><td><input type="checkbox" /> 2</td></tr>
<tr><td><input type="checkbox" /> 3</td></tr>
<tr><td><input type="checkbox" /> 4</td></tr>
</table>