zoukankan      html  css  js  c++  java
  • js实现CheckBox全选全不选

    CheckBox全选全不选的js方法

    效果:

     

    页面 :<table style=" 2350px; table-layout: fixed;" border="0" cellpadding="0" cellspacing="1"
    bgcolor="b5d6e6" class="data_table">
    <tr class="scrollColThead ">
    <td width="100" class="tb_h scrollRowThead scrollCR">
    <input type="checkbox" name="checkAll" class="selectAll" onclick="chkChange();" />
    <a href="#" onclick="Del_more()">多项删除</a>
    </td>
    <td width="100" class="tb_h scrollRowThead scrollCR">
    商品编号
    </td>
    <td width="120" class="tb_h scrollRowThead scrollCR">
    商品名称
    </td>
    </tr>
    <asp:Repeater ID="InStoOrdRep" runat="server">
    <ItemTemplate>
    <tr>
     <td class="tb_d scrollRowThead">
    <input type="checkbox" class="cb_box" name="chk_delete" value="<%# Eval("Sto_Id") %>" />
    </td>
    <td title='<%# Eval("Sto_ComNum")%>' class="tb_d hid_td scrollRowThead ">
    <%# Eval("Sto_ComNum")%>
    </td>
    <td title='<%# Eval("Sto_ComName")%>' class="tb_d hid_td scrollRowThead ">
    <%# Eval("Sto_ComName")%>
    </td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>
    </table>

    js代码:

    //全选
    function chkChange() {
    if ($(".selectAll").attr("checked")) {
    $(".cb_box").each(function () {
    $(this).attr("checked", true);
    });
    } else {
    $(".cb_box").each(function () {
    $(this).attr("checked", false);
    });
    }
    }

  • 相关阅读:
    mac允许安装任何来源的软件
    Xcode Edit Schemes
    认识下算法工程师
    一定要熟练地使用常用的Foundation服务
    常用的UI控件
    认识iOS系统架构
    深拷贝/浅拷贝的理解
    Create Fiori List App Report with ABAP CDS view – PART 1
    [転載]SAP S/4HANAトライアル環境でCDS Viewを確認
    ABAP CDS
  • 原文地址:https://www.cnblogs.com/lk516924/p/4107849.html
Copyright © 2011-2022 走看看