标签:doc document index.php type store val java nts checkbox
一 index.php
<!DOCTYPE html>
<html>
<head>
<script language="JavaScript" src="Jquery.js"></script>
<title></title>
</head>
<body>
1<input type="checkbox" name="dept">
1<input type="checkbox" name="dept">
1<input type="checkbox" name="dept">
1<input type="checkbox" name="dept">
1<input type="checkbox" name="dept">
1<input type="checkbox" name="dept">
1<input type="checkbox" name="dept">
<input type="button" name="button1" value="全选" onclick=‘choose("opt")‘>
<input type="button" name="button1" value="反选" onclick=‘choose("fopt")‘>
</body>
</html>
二
Jquery.js代码
function choose(dept)
{
store=document.getElementsByName("dept");
if(dept=="opt")
{
for(i=0;i<store.length;i++)
{
store[i].checked=true;
}
}
else if(dept=="fopt")
{
for(i=0;i<store.length;i++)
{
store[i].checked = !store[i].checked;
}
}
}
标签:doc document index.php type store val java nts checkbox
原文地址:http://www.cnblogs.com/chouxiaoyademeng/p/6001981.html