zoukankan      html  css  js  c++  java
  • Js全选,插入实现

      //全选
            function CheckAll() {
                ids.splice(0, 1000000);
                var flag = $("#All_Check").attr("checked");
                $(".orderCheck").each(function () {
                        if (typeof (flag) == 'undefined')
                            flag = false;
                        //$(":input[type=checkbox]").attr("checked", flag);
                        $(this).children().attr("checked", flag);
                        if ($(this).children().attr("checked")) {
                            ids.push($(this).attr("SupplierId"));
                        } else {
                            for (var i in ids) {
                                if ($(this).attr("SupplierId") == ids[i]) {
                                    ids.splice(i, 1);
                                    break;
                                }
                            }
                        }
                    }
                );
                $("#hfids").val(ids);
            }
            //插入订单号
            function InsertOrderCoder(obj) {
                if (obj.attr("checked")) {
                    ids.push(obj.parent().attr("SupplierId"));
                }
                else {
                    for (var i in ids) {
                        if (obj.parent().attr("SupplierId") == ids[i]) {
                            ids.splice(i, 1);
                            break;
                        }
                    }
                }
                $("#hfids").val(ids);
            }
            //点击搜索加载所有勾选的供应商
            function ConfirmSelectedId()
            {
                ids.splice(0, 1000000);
                $(".orderCheck").each(function () {
                    if ($(this).children().attr("checked")) {
                        ids.push($(this).attr("SupplierId"));
                    } 
                }
                );
                $("#hfids").val(ids);
            }
    
    
    
      <td style="text-align:right;">
                     <asp:Button ID="btSearch" Text="搜索" runat="server" style="height: 25px;  60px;" OnClick="btSearch_Click" OnClientClick="ConfirmSelectedId();"/>
                </td>
    
    
    
    
     <th width="4%">
                     <input type="checkbox" id="All_Check" onclick="CheckAll();" />
    </th>
    
    
     <td align="center">
                             <%--<input type="checkbox" class="orderCheck" value='<%# Eval("SupplierId")%>' name="<%# Eval("ProductBaseId")%>" onclick="InsertOrderCoder($(this));" />--%>    
                          <asp:CheckBox runat="server" CssClass="orderCheck"  SupplierId='<%# Eval("SupplierId")%>' onclick="InsertOrderCoder($(this));"/>
                                   
                        </td>
    
  • 相关阅读:
    基于silverlight 实现的文件浏览器
    基于silerlight for embedd 视频播放器的之一的问题
    DSHOW_IVideoWindow的不解
    图片浏览开发初步的问题
    MOSS 修改计算机名称
    MOSS中显示登录用户在AD中的全名
    MOSS工作流任务权限控制
    RMS配置
    修改AD密码的方法
    MOSS母板页中的PlaceHolder
  • 原文地址:https://www.cnblogs.com/Unrmk-LingXing/p/4271712.html
Copyright © 2011-2022 走看看