<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; " />
<title>php处理复选框checkbox的全选与全不选-www.jb200.com</title>
<script language="
javascript" type="text/javascript">
function check_all()
{
var check_list = document.getElementsByName("Bton[]");
for(var i = 0; i < check_list.length; i++)
{
check_list[i].
checked = true;
}
//return false;
}
function check_none()
{
var check_list = document.getElementsByName("Bton[]");
for(var i = 0; i < check_list.length; i++)
{
check_list[i].checked = false;
}
}
</script>
</head>
<body>
<form name="form1">
<?php
for($i=0;$i<10;$i++){?>
<tr><td>
<input type=checkbox name=Bton[]>
<br>
</tr></td>
<?php } ?>
<input type="button" name="b1" id="b1" value="全选" onclick="check_all()"/>
<input type="button" name="b2" id="b2" value="全不选" onclick="check_none()"/>
</from>
</body>
</html>