`
___loveOfForever
  • 浏览: 75948 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

全选,点击链接全选,选中多选框全选以及反选,全不选

阅读更多
<html>
<head>
<title>JSP for UserForm form</title>
head>
<script type="text/javascript">
   var checkboxs=document.getElementsByName("deptno");
   function SelectAll(){
      document.getElementById("BakchkAll").checked = true;
      document.getElementById("chkAll").checked=false;
      document.getElementById("NochkAll").checked=false;
      for (var i=0;i<checkboxs.length;i++) {
         var chk=checkboxs[i];
         chk.checked=!chk.checked;
      }
   }
   function SelectAlls(){
      document.getElementById("chkAll").checked=true;
      document.getElementById("BakchkAll").checked=false;
      document.getElementById("NochkAll").checked=false;
      for (var i=0;i<checkboxs.length;i++) {
         checkboxs[i].checked = true;
      }
   }
   function NoSelectAll(){
       document.getElementById("chkAll").checked=false;
       document.getElementById("BakchkAll").checked =false;
       document.getElementById("NochkAll").checked=true;
       for (var i=0;i<checkboxs.length;i++) {
         checkboxs[i].checked = false;
       }
   }
   function chAll(){
     var objCheckAll = document.getElementById("chkAll");
     document.getElementById("NochkAll").checked=false;
     document.getElementById("BakchkAll").checked=false;
     if(objCheckAll.checked==true){
       SelectAlls();
     }
   }
   function NochAll(){
     var objCheckAll = document.getElementById("NochkAll");
     if(objCheckAll.checked==true){
       NoSelectAll();
     }
   }
   function BakchAll(){
    var objCheckAll = document.getElementById("BakchkAll");
    if(objCheckAll.checked==true){
      SelectAll();
      document.getElementById("NochkAll").checked=false;
      document.getElementById("chkAll").checked=false;
    }
   }
</script>
<body>
<form name="areaForm" id="areaForm" method="post" action="/Submit.do">

<table width="80%" cellspacing="1" cellpadding="3" align="center">   <tr>
   <td class="infoColumnName">地点<font color='red'>**</font></td>
      <td class="infoColumnValue">
      <table>
      <tr>
                       <td><input type="checkbox" id="chkAll" onclick="javascript:chAll()"/>
                         全选     
                         <input type="checkbox" id="NochkAll" onclick="javascript:NochAll()"/>
                         全不选     
                         <input type="checkbox" id="BakchkAll" onclick="javascript:BakchAll()"/>
                         反选
                       </td>
                    </tr>
         <tr>
         <td width="50%">
  
    <input type="checkbox" id="deptno" name="deptno" value="5301">    南京                           
  
    <input type="checkbox" id="deptno" name="deptno" value="5302">    无锡                            
  
   <br/>
  
    <input type="checkbox" id="deptno" name="deptno" value="5303">    深圳                            
  
    <input type="checkbox" id="deptno" name="deptno" value="5304">    南昌                             
  
   <br/>
  
    <input type="checkbox" id="deptno" name="deptno" value="5305">    苏州                            
  
    <input type="checkbox" id="deptno" name="deptno" value="5306">    北京                            
  
   <br/>
  
    <input type="checkbox" id="deptno" name="deptno" value="5308">    广州                            
  
    <input type="checkbox" id="deptno" name="deptno" value="5309">    扬州                             
  
   <br/>
  
    <input type="checkbox" id="deptno" name="deptno" value="5310">    海南                            
  
    <input type="checkbox" id="deptno" name="deptno" value="5311">    镇江                           
  
   <br/>
  
    <input type="checkbox" id="deptno" name="deptno" value="5312">    泰州                            
  
          </td>
          </tr>
      </table>
       </td>
   </tr>
   <tr>
   <td colspan="4" class="infoTitle" align="center">
   <input type="button" name="Submit" value="提交" onClick=check();>
   <input type="reset" value="重置">   </td>
   </tr>
</table>
</form>
</body>
</html>

0
4
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics