点击选人打开新的窗口,新窗口中选取之后点击确定将所选内容传给原窗口,并关闭当前窗口

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
#TextBox1 {
width: 300px;
height: 300px;
cursor: no-drop;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" TextMode="MultiLine" runat="server"></asp:TextBox>
<input type="button" id="btn111" value="选人" />
<br /> //<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
//<asp:Button ID="Button1" runat="server" Text="Button" /> </div>
</form>
</body>
</html> <script>
document.getElementById("btn111").onclick = function () {
window.open("Default2.aspx", "_blank", "width=400 height=400");
}
</script>

JS 实战2(邮箱选人功能)-LMLPHP

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

 <!DOCTYPE html>

 <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
#ListBox1, #ListBox2 {
width: 200px;
height: 200px;
float: left;
}
</style> </head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" SelectionMode="Multiple" runat="server">
<asp:ListItem Value="">苹果</asp:ListItem>
<asp:ListItem Value="">橘子</asp:ListItem>
<asp:ListItem Value="">香蕉</asp:ListItem>
<asp:ListItem Value="">葡萄</asp:ListItem>
<asp:ListItem Value="">张柯</asp:ListItem>
</asp:ListBox>
<div style="float: left;">
<%--<input type="button" id="btn1" value="添加>>>" /><br />
<input type="button" id="btn2" value="<<<移除" />--%>
<input type="button" id="btn_ok" value="确定" />
</div>
<%--<asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>--%> </div>
</form>
</body>
</html> <%--<script src="JavaScript.js"></script>
<script src="JavaScript2.js"></script>--%> <script>
document.getElementById("btn_ok").onclick = function () {
var oLb1 = document.getElementById("ListBox1");
var end = ""; for (var i = ; i < oLb1.options.length; i++) {
if (oLb1.options[i].selected) {
end += oLb1.options[i].innerHTML + ",";
}
} window.opener.document.getElementById("TextBox1").value = end;
window.close(); }; </script>

JS 实战2(邮箱选人功能)-LMLPHP

点击确定:

JS 实战2(邮箱选人功能)-LMLPHP

05-07 14:54