web中的大量操作,web大量操作

來源:互聯網
上載者:User

web中的大量操作,web大量操作

1,大量操作之大量刪除(增刪改)

<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>  


2,大量操作之彈出框

<a class="" id="" onclick="show_ad()" style="">設定詞</a> 

<pre name="code" class="javascript">function show_ad() {    var aaa = "";    jQuery("#tbl_type2 tr").each(function() {        var text = $(this).children("td:first").find("input[type=checkbox]:checked");        if (text.val() != undefined) {            aaa = text.val() + "," + aaa;        }    });    if (aaa != null && aaa != "") {        alert(aaa);        jQuery("#addiv1").css({            display: "block"        });        jQuery("#addiv2").css("display", "block");    } else {        alert("請選擇對象");        return false;    }}

id為tbl_type2的table的第一個td


<pre name="code" class="html"><td class="td-check">    <input type="checkbox" name="ids" id="selectWare_<s:property value=" id    "/>"value="<s:property value=" id "/>"/></td>
全選的js代碼
<pre name="code" class="javascript">//全選、反選$("#top_selectAll").click(function() {    $('input[type=checkbox]').attr("checked", $(this).attr("checked") ? true: false);});
彈出框代碼
<div id="addiv1"></div><div id="addiv2" style="display:none; margin: 0px auto;top: 30%" class="pop pop_v1">    <h4>        <span class="winTitle">            大量設定        </span>        <a id="closead" class="btn_cel">            關閉        </a>    </h4>    <div style=" margin-top: 20px; padding-left: 50px;">        <label>            <font style="font-size: 13px; color: black;">                詞:            </font>        </label>        <div>            <s:textarea name="adindroduce" rows="10" style="width: 90%; margin-top: 5px; overflow:scroll; overflow-x:hidden; resize: none;">            </s:textarea>            <br>            <div style="height:10px; ">            </div>        </div>        <br/>        <br/>        <input type="button" id="savecatalog" class="btn-newsearch btn_reelect2"        value="保   存" style="width:72px; font-        size: 12px; padding:0px;" onclick="setad();">        <input type="button" id="quxiao" class="btn-newsearch btn_reelect2" value="取   消"        style="width:72px; font-size: 12px; padding:0px;">    </div></div>
儲存和取消的js代碼
</pre><pre name="code" class="javascript">function setad(){<span style="white-space:pre"></span> $("#pform").attr("action","<%=basePath%>/manage/product!updateAd.action"); $("#pform").submit(); <span style="white-space:pre"></span>return false;} $("#quxiao").click(function() { <span style="white-space:pre"></span>$("#addiv1").css("display", "none");    <span style="white-space:pre"></span>$("#addiv2").css("display", "none"); }); $("#closead").click(function(){ <span style="white-space:pre"></span>$("#addiv1").css("display", "none"); <span style="white-space:pre"></span>$("#addiv2").css("display", "none");});

</pre><pre>





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.