<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>复选框——全选/反选</title>
<LINK href="css/style.css" type=text/css rel=stylesheet>
<script language="javascript" src="jquery.js"></script>
</head>
<script>
$(function(){
$("#allcheckbox").click(function(){
var checkboxObj=$("table tr:gt(0) :checkbox");
if($(this).attr("checked")==true){
checkboxObj.each(function(){
$(this).attr("checked",true);
});
}else{
checkboxObj.each(function(){
$(this).attr("checked",false);
});
}
});
})
</script>
<body>
<table width="567" height="169" border="1" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td align="center" valign="middle"><label>
<input id="allcheckbox" type="checkbox" name="checkbox" value="checkbox" />
</label></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox2" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox3" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox4" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox4" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox4" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox4" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox4" value="checkbox" /></td>
</tr>
<tr>
<td> </td>
<td align="center" valign="middle"><input type="checkbox" name="checkbox4" value="checkbox" /></td>
</tr>
</table>
</body>
</html>