<!DOCTYPE html>
<html>
<script type="text/javascript">
function selectAll(obj){
var flag=obj.checked;
var arr=document.getElementsByClassName("it");
var i;
for(i=0;i<arr.length;i++){
arr[i].checked=flag;
}
}
</script>
</head>
<body>
<table border="1" width="200" height="400" cellpadding="0" cellspacing="0" align="center">
<tr align="center">
<td>
<input type="checkbox" οnclick="selectAll(this)"/>
</td>
<td>全选</td>
</tr>
<tr align="center">
<td>
<input type="checkbox" class="it"/>
</td>
<td>java</td>
</tr>
<tr align="center">
<td><input type="checkbox" class="it" /></td>
<td>c语言</td>
</tr>
<tr align="center">
<td><input type="checkbox" class="it" /></td>
<td>c++</td>
</tr>
<tr align="center">
<td><input type="checkbox" class="it" /></td>
<td>c#</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title><script type="text/javascript">
function selectAll(obj){
var flag=obj.checked;
var arr=document.getElementsByClassName("it");
var i;
for(i=0;i<arr.length;i++){
arr[i].checked=flag;
}
}
</script>
</head>
<body>
<table border="1" width="200" height="400" cellpadding="0" cellspacing="0" align="center">
<tr align="center">
<td>
<input type="checkbox" οnclick="selectAll(this)"/>
</td>
<td>全选</td>
</tr>
<tr align="center">
<td>
<input type="checkbox" class="it"/>
</td>
<td>java</td>
</tr>
<tr align="center">
<td><input type="checkbox" class="it" /></td>
<td>c语言</td>
</tr>
<tr align="center">
<td><input type="checkbox" class="it" /></td>
<td>c++</td>
</tr>
<tr align="center">
<td><input type="checkbox" class="it" /></td>
<td>c#</td>
</tr>
</table>
</body>
</html>