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);
    });
    }
    }

  • 相关阅读:
    UML 入门课程
    在Visio中建立数据库模型的步骤
    phpMyAdmin
    采用软件负载均衡器实现web服务器集群
    Javascript 调用后台方法
    log4net 使用相关要点汇总
    静栈/动堆
    国外web 2.0网站模板
    yum应用学习笔记
    分页 : 存储分页 :row_number
  • 原文地址:https://www.cnblogs.com/lk516924/p/4107849.html
Copyright © 2011-2022 走看看