代码如下:
<th><input type="checkbox" id="ckSelectAll"></th> <td><input type="checkbox" name="uid" value="${user.id}"></td> <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("#ckSelectAll").click(function(){ $("input[name=uid][type=checkbox]").each(function(){ $(this).prop("checked",$("#ckSelectAll").prop("checked")); }); }); }); </script>