<!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>
<script>
function all()
{
var checkboxs = document.getElementsByName("email");
for(var i = 0; i < checkboxs.length; i++)
checkboxs[i].checked = true;
}
function allNo()
{
var checkboxs = document.getElementsByName("email");
for(var i = 0; i < checkboxs.length; i++)
checkboxs[i].checked = false;
}
function contrary()
{
var checkboxs = document.getElementsByName("email");
for(var i = 0; i < checkboxs.length; i++)
{
if(checkboxs[i].checked == true)
checkboxs[i].checked = false;
else
checkboxs[i].checked = true;
}
}
</script>
</head>
<body>
<input type="checkbox" name="email" id=""/>第一封信<br/>
<input type="checkbox" name="email" id=""/>第二封信<br/>
<input type="checkbox" name="email" id=""/>第三封信<br/>
<input type="checkbox" name="email" id=""/>第四封信<br/>
<input type="checkbox" name="email" id=""/>第五封信<br/>
<input type="button" value="全不选" onclick="allNo();"/>
<input type="button" value="反选" onclick="contrary();"/>
<input type="button" value="全选" onclick="all();"/>
</body>
</html>