多选

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReceiverEmail_List.aspx.cs" Inherits="Web_Admin_ReceiverEmail_ReceiverEmail_List" %>

<%@ Register src="../ascx/navigation.ascx" tagname="navigation" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>接收消息邮箱管理</title>
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../css/default.css" />
    <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../js/default.js"></script>
    <script type="text/javascript" src="../js/jquery.cookie.js"></script>
    <script type="text/javascript">
        var qyItems = "sel_yj";
        var lx = 0;
        var objCB;
        $(function() {            
            objCB = $("input:checkbox[im]");
            objCB.bind("click", function() {
                lx = 0;
                addSQ($(this));
            });
            $("[qx='1']").bind("click", function() {
                $("input:checkbox[im]").attr("checked", $(this).attr("checked"));
                objCB.each(function(i) {
                    lx = 1;
                    addSQ($(this));
                });
            });
            loadSQL();
        });
        function loadSQL() {
            var tempMs = "";
            if ($.cookie(qyItems) != null) {
                objCB.each(function(i) {
                    if (lx == 0) {
                        if (($.cookie(qyItems) + ",").indexOf("," + $(this).attr("im") + ",") > -1)
                            $(this).attr("checked", true);
                        else
                            $(this).attr("checked", false);
                    }
                });
                var hylb = $.cookie(qyItems).split(',');
                var l = hylb.length;
                for (var i = 0; i < l; i++) {
                    if ($.trim(hylb[i]).length > 0)
                        tempMs += "、<font color='#339900'>" + (hylb[i].split('|')[1]) + "</font>";
                }
            }
            $("#spanHY").html(tempMs.substring(1, tempMs.length));
        }
        function addSQ(e) {
            var items = $.cookie(qyItems);
            var sxCurrent = $(e).attr("checked");
            if (sxCurrent) {
                if (items == null) {
                    $.cookie(qyItems, "," + $(e).attr("im"), { path: '/' });
                } else {
                    if (($.cookie(qyItems) + ",").indexOf("," + $(e).attr("im") + ",") == -1)
                        $.cookie(qyItems, $.cookie(qyItems) + "," + $(e).attr("im"), { path: '/' });
                }
            }
            else {
                if (items != null) {
                    if ($.cookie(qyItems).indexOf("," + $(e).attr("im")) > -1) {
                        $.cookie(qyItems, $.cookie(qyItems).replace("," + $(e).attr("im"), ''), { path: '/' });
                    }
                }
            }
            loadSQL();
        }

        var j;
        var wyh;
        var dlh;
        var dll;
        $(function() {
            wyh = $(document).height();
            $("#btnselect2").bind("click", function() {
                if ($.cookie(qyItems)) {
                    j = 0;
                    $("#yjText").val("");
                    $("#yjTitle").val("");
                    $("#spanTitle").html("邮件内容");
                    $("#divZZ").css({ "top": 0, "left": 0, "width": "100%", "height": wyh + "px", "opacity": 0.8 });
                    isShow(j);
                }
                else
                    alert("请选择需要发送邮件的用户!");
            });
            $("#aClose").bind("click", function() {
                j = 1;
                isShow(j);
            });
        });
        $(window).resize(function() {
            isShow(j);
        });
        $(window).scroll(function() {
            isShow(j);
        });
        function isShow(ee1) {
            if (ee1 == 0) {
                dlh = ($(window).height() - $("#divLogin").height()) / 2 + $(document).scrollTop();
                dll = ($(window).width() - $("#divLogin").width()) / 2 + $(document).scrollLeft();
                $("#divLogin").css({ "top": dlh + "px", "left": dll + "px" });
                $("#divZZ").show();
                $("#divLogin").show();
            }
            else {
                $("#divZZ").hide();
                $("#divLogin").hide();
            }
        }
        function fsyj() {
            var bt = $("#yjTitle").val();
            if ($.trim(bt).length < 1) {
                $("#spanTitle").html("请认真填写邮件标题!");
                return;
            }
            var nr = $("#yjText").val();
            if ($.trim(nr).length < 1) {
                $("#spanTitle").html("请认真填写发送内容!");
                return;
            }
            $.ajax({
                type: "POST",
                url: "yy.aspx",
                data: { "bt": bt, "nr": nr },
                beforeSend: function(xmlHttpRequest) {
                    $("#yjText").attr("disabled", true);
                    $("#yjTitle").attr("disabled", true);
                    $("#btnGo").attr("disabled", true);
                    $("#aClose").attr("disabled", true);
                    $("#spanTitle").html("<img src='/images/loading.gif' />正在发送邮件,请耐心等候。。。");
                },
                success: function(data, textStatus) {
                    $("#spanTitle").html("已经发送完成");
                    $.cookie(qyItems, null, { path: '/' });
                    if (data == "a")
                        alert("标题或内容为空!");
                    else if (data == "c") {
                        alert("已经发送完成!");
                        window.location.href = window.location.href;
                    } else if (data == "b") {
                        alert("没有选择用户!");
                    } else if ($.trim(data).length > 0)
                        alert(data);
                    else {
                        alert("已经发送完成");
                        window.location.href = window.location.href;
                    }
                },
                complete: function(xmlHttpRequest, textStatus) {
                    $("#spanTitle").html("邮件内容");
                    $("#yjText").attr("disabled", false);
                    $("#yjTitle").attr("disabled", false);
                    $("#btnGo").attr("disabled", false);
                    $("#aClose").attr("disabled", false);
                },
                error: function() {
                    alert("发送邮件出现错误!");
                }
            });
        }
    </script>
</head>
<body>
<form id="form1" runat="server">
<uc1:navigation ID="navigation1" Title="接收消息邮箱管理" runat="server" />
<div class="adRbox">
     <div id="searchBox" class="searchBox">
     <input type="button" id="btnselect2" value="发送邮件" class="sbtn" style=" 60px;"
                    onclick="window.returnValue='0';window.close();" />已选择的会员:<span id="spanHY"></span>
        <!-- 搜索条件 --> 
        <div style="display:none;">
        <input name="" type="button" value="搜索" class="sbtn" onclick="search();" />
        <input name="" type="button" value="重置" class="sbtn" onclick="search_rest();" />
        </div>
    </div> 
    <div class="arTabBox">
        <table id="tb_list" width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <th width="50" style="text-align:right;"><input id="chk_all" qx='1' onclick="select_all(this);" type="checkbox" /></th>
            <th class="cen">邮箱</th>
            <th class="cen" width="70">操作</th>
          </tr>
        <asp:Repeater ID="rpList" runat="server">
            <ItemTemplate>
             <tr>
                <td style="text-align:right;"><input name="checkboxs" type="checkbox" im='<%# Eval("Id") + "|" + Eval("Email") %>' value="<%# Eval("Id") %>" /></td>
                <td class="cen"><%# Eval("Email") %></td>
                <td class="cen"><a href="ReceiverEmail_Add.aspx?id=<%# Eval("Id") %>">编辑</a></td>
              </tr>
            </ItemTemplate>
        </asp:Repeater>
        </table>                                                                                         
        <asp:Literal ID="lit_nodata" Visible="false" Text="<div style='text-align:center; margin-top:10px;'>无记录</div>" runat="server"></asp:Literal>
    </div>
    
    <div style="text-align:right; margin-top:10px;">
        <asp:Button ID="But_Delete" runat="server" Text="删除" CssClass="sbtn" OnClientClick="return check_post('确定要删除吗?');" onclick="But_Delete_Click" />&nbsp;&nbsp;
        <asp:Button ID="But_Excel" runat="server" Text="导出Excel" CssClass="sbtn bn1" onclick="But_Excel_Click" />
    </div>
    
    <my:aspnetpager class="arPage" PageSize="20" UrlPaging="true" 
            runat="server" ID="pgServer" 
            CustomInfoHTML="共%PageCount%页记录<span>|</span>每页<em>%PageSize%</em>条<span>|</span>当前第<em>%CurrentPageIndex%</em>页" 
            FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" 
            ShowCustomInfoSection="Left" Height="18px" >
    </my:aspnetpager>
    
</div>
<script type="text/javascript">
    jQuery(document).ready(function ($) {
        $(".arTabBox tr:gt(0):odd").css("background", "#F1F1F1");
    });    
</script>
<div id="divZZ" style="position: absolute; z-index: 9; background-color: #79A7E2;
        display: none;">
    </div>
    <div id="divLogin" style="position: absolute; z-index: 10; background-color: White;
         400px; height: 320px; display: none; border: solid 1px #339900;">
        <table>
            <tr>
                <td>
                    <span style="font-size:14px; color:#339900; font-weight:bold;" id="spanTitle"></span><br />
                    标题:<input type="text" id="yjTitle" style="330px; border:solid 1px #79A7E2;" /><br />
                    内容:<textarea id="yjText" style="350px; height:220px; border:solid 1px #79A7E2;"></textarea>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <input type="button" id="btnGo" value="发送" class="buttoncls" onclick="fsyj();" />
                    <input type="button" id="aClose" value="取消" class="buttoncls" />
                </td>
            </tr>
        </table>
    </div>
</form>
</body>
</html>
原文地址:https://www.cnblogs.com/daixingqing/p/2768448.html