批量删除的js代码

  1. <script type="text/javascript">  
  2.     function seltAll(){  
  3.         var chckBoxSign = document.getElementById("ckb");       //ckb 全选/反选的选择框id  
  4.         var chckBox = document.getElementsByName("chckBox");    //所有的选择框其那么都是chckBox  
  5.         var num = chckBox.length;  
  6.         if(chckBoxSign.checked){  
  7.             for(var index =0 ; index<num ; index++){  
  8.                 chckBox[index].checked = true;  
  9.                 }  
  10.         }else{  
  11.             for(var index =0 ; index<num ; index++){  
  12.                 chckBox[index].checked = false;  
  13.                 }  
  14.             }  
  15.         }  
  16.   
  17.     function deleSeltedRecords(){  
  18.         var chckBox = document.getElementsByName("chckBox");  
  19.         var num = chckBox.length;  
  20.         var ids = "";  
  21.         for(var index =0 ; index<num ; index++){  
  22.             if(chckBox[index].checked){  
  23.                 ids += chckBox[index].value + ",";                
  24.             }  
  25.         }  
  26.         if(ids!=""){  
  27.             if(window.confirm("确定删除所选记录?")){  
  28.                 $.ajax( {  
  29.                     type : "post",  
  30.                     url : '../g3/history-no!batchDelete.action?ids=' + ids, //要自行删除的action  
  31.                     dataType : 'json',  
  32.                     success : function(data) {  
  33.                         alert("删除成功");  
  34.                         window.location.href = "channel-no.action" ;  
  35.                     },  
  36.                     error : function(data) {  
  37.                         alert("系统错误,删除失败");  
  38.                     }  
  39.                 });  
  40.             }  
  41.         }else{  
  42.             alert("请选择要删除的记录");  
  43.             }  
  44.         }  
  45. </script>  
posted @   G-Beniot  阅读(1312)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示