html代碼
<th><input type="checkbox" onclick="selectAll(this);" />全選/取消</th>
js代碼(前提是引用了jquery)
<script type="text/javascript">
function selectAll(checkbox) {
$('input[type=checkbox]').prop('checked', $(checkbox).prop('checked'));
}
</script>
