js代码
<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>
<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>