<html>
<head>
<title>JS点击全选复选框</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
// End -->
</script>
</head>
<body>
<form name=myform action="" method=post>
<table>
<tr><td>
<input type=checkbox name=list value="1">Java
<input type=checkbox name=list value="2">PHP
<input type=checkbox name=list value="3">ASP.net
<input type=checkbox name=list value="4">JQUERY
<input type=checkbox name=list value="5">AJAX
<input type=button value="全选" onClick="this.value=check(this.form.list)">
</td></tr>
</table>
</form>
</body>
</html>