Chinaunix首页 | 论坛 | 博客
  • 博客访问: 149257
  • 博文数量: 44
  • 博客积分: 2330
  • 博客等级: 大尉
  • 技术积分: 405
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-09 11:57
文章分类
文章存档

2012年(6)

2011年(32)

2010年(6)

分类: LINUX

2011-03-29 10:48:17

原文地址:
 
方法一:
 
  1. <script>
  2.             function checkAll()
  3.             {
  4.                 var code_Values = document.all['code_Value'];
  5.                 if(code_Values.length){
  6.                     for(var i=0;i<code_Values.length;i++)
  7.                     {
  8.                         code_Values[i].checked = true;
  9.                     }
  10.                 }else{
  11.                     code_Values.checked = true;
  12.                 }
  13.             }
  14.             
  15.             function uncheckAll()
  16.             {
  17.                 var code_Values = document.all['code_Value'];
  18.                 if(code_Values.length){
  19.                     for(var i=0;i<code_Values.length;i++)
  20.                     {
  21.                         code_Values[i].checked = false;
  22.                     }
  23.                 }else{
  24.                     code_Values.checked = false;
  25.                 }
  26.             }
  27.             
  28.             function multipleDelete()
  29.             {
  30.                 var num = 0;
  31.                 var code_Values = document.all['code_Value'];
  32.                 if(code_Values.length){
  33.                     for(var i=0;i<code_Values.length;i++)
  34.                     {
  35.                         if(code_Values[i].checked == true)
  36.                         {
  37.                             num ++;
  38.                         }
  39.                     }
  40.                 }else{
  41.                     if(code_Values.checked == true){
  42.                         num ++ ;
  43.                     }
  44.                 }
  45.                 if(num == 0){
  46.                     alert('Please select delete item');
  47.                 }
  48.                 if(num >0){
  49.                     document.BuCodeSearch.action = '<%=EusUtil.getPage("lookup.generic.bucode.delete.s")%>';
  50.                     document.BuCodeSearch.submit();
  51.                 }
  52.             }
  53.         </script>

 

 

方法二:

 

  1. <script>
  2.     function checkAll()
  3.     {
  4.         var code_Values = document.getElementsByTagName("input");
  5.         for(i = 0;i < code_Values.length;i++){
  6.             if(code_Values[i].type == "checkbox")
  7.             {
  8.                 code_Values[i].checked = true;
  9.             }
  10.         }
  11.     }
  12.     function uncheckAll()
  13.     {
  14.         var code_Values = document.getElementsByTagName("input");
  15.         for(i = 0;i < code_Values.length;i++){
  16.             if(code_Values[i].type == "checkbox")
  17.             {
  18.                 code_Values[i].checked = false;
  19.             }
  20.         }
  21.     }
  22.     function multipleDelete()
  23.     {
  24.         if (document.BuCodeSearch.elements["code_Value"])
  25.         {
  26.             var num = 0;
  27.             var fm = document.BuCodeSearch;
  28.             if (document.BuCodeSearch.elements["code_Value"])
  29.             {
  30.                 var elm = document.BuCodeSearch.elements["code_Value"];
  31.                 var ename = "code_Value";
  32.                 if (elm.length) {
  33.                     var len = fm.elements[ename].length;
  34.                     for (var i = 0; i< len; i++) {
  35.                         var e = fm.elements[ename][i];
  36.                         if (e.checked == true){
  37.                             num++;
  38.                         }
  39.                     }
  40.                 } else {
  41.                     if (elm.checked == true ) {
  42.                         num++;
  43.                     }
  44.                 }
  45.                 if (num > 0 )
  46.                 {
  47.                     document.BuCodeSearch.action = '<%=EusUtil.getPage("lookup.generic.bucode.delete.s")%>';
  48.                     document.BuCodeSearch.submit();
  49.                 }
  50.             }
  51.         }
  52.     }
  53. </script>
阅读(1208) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~