<script type="text/javascript">
$("document").ready(function() {
$("#all").click(function() {
$("[name='single']").attr("checked", this.checked);
});
$("[name='single']").click(function() {
$("#all").attr("checked", this.checked);
});
});
</script>
<body>
<table border="1">
<tr>
<td>
全选
<input type="checkbox" id="all">
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="single" name="single" value="single">
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="single" name="single" >
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="single" name="single" >
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="single" name="single" >
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="single" name="single" >
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="single" name="single">
</td>
</tr>
</table>
</body>
jquery复选框
最新推荐文章于 2024-06-11 20:43:12 发布