<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
</head>
<body>
<table width="500" border="1">
<tr>
<td><input type="checkbox" id="d1"></td>
<td>科目</td>
<td>老师</td>
</tr>
<tr>
<td><input type="checkbox" id="d2"></td>
<td>PHP开发</td>
<td>张老师</td>
</tr>
<tr>
<td><input type="checkbox" id="d3"></td>
<td>平面设计</td>
<td>王老师</td>
</tr>
<tr>
<td><input type="checkbox" id="d4"></td>
<td>室内设计</td>
<td>李老师</td>
</tr>
</table>
<script type="text/javascript">
$(function(){
$("#d1").click(function(){
if(this.checked){
$("input").prop("checked", true);
}else{
$("input").prop("checked", false);
}
});
});
</script>
</body>
</html>
相关分类