日期:2014-05-19 浏览次数:20755 次
<!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; charset=gb2312" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
function quanxuan(){
var checkboxs = document.getElementsByName("checkbox");
for(var i=0;i<checkboxs.length;i++){
checkboxs[i].checked=true;
}
}
function fanxuan()(){
var checkboxs = document.getElementsByName("checkbox");
for(var i=0;i<checkboxs.length;i++){
checkboxs[i].checked=false;
}
}
</script>
<body>
<div id="checkboxTest">
<input type="checkbox" name="checkbox" value="checkbox" />
<input type="checkbox" name="checkbox" value="checkbox" />
<input type="checkbox" name="checkbox" value="checkbox" />
<input type="checkbox" name="checkbox" value="checkbox" />
</div>
<div>
<input name="quanxuan" type="button" onclick="quanxuan()" value="全选"/>
<input name="fanxuan" type="button" onclick="fanxuan()" value="反选"/>
</div>
</body>
</html>