- <script type="text/javascript">
- function seltAll(){
- var chckBoxSign = document.getElementById("ckb"); //ckb 全選/反選的選擇框id
- var chckBox = document.getElementsByName("chckBox"); //所有的選擇框其那麼都是chckBox
- var num = chckBox.length;
- if(chckBoxSign.checked){
- for(var index =0 ; index<num ; index++){
- chckBox[index].checked = true;
- }
- }else{
- for(var index =0 ; index<num ; index++){
- chckBox[index].checked = false;
- }
- }
- }
- function deleSeltedRecords(){
- var chckBox = document.getElementsByName("chckBox");
- var num = chckBox.length;
- var ids = "";
- for(var index =0 ; index<num ; index++){
- if(chckBox[index].checked){
- ids += chckBox[index].value + ",";
- }
- }
- if(ids!=""){
- if(window.confirm("確定刪除所選記錄?")){
- $.ajax( {
- type : "post",
- url : '../g3/history-no!batchDelete.action?ids=' + ids, //要自行刪除的action
- dataType : 'json',
- success : function(data) {
- alert("刪除成功");
- window.location.href = "channel-no.action" ;
- },
- error : function(data) {
- alert("系統錯誤,刪除失敗");
- }
- });
- }
- }else{
- alert("請選擇要刪除的記錄");
- }
- }
- </script>
checkbox批量刪除js(全選/全部選)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.