父窗口 Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!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"> <title>无标题页</title> <script type='text/javascript'> function openWindow() { window.open('Popup.aspx','_blank','height=450,width=470,status=no,toolbar=no,menubar=no,scrollbars=no,location=no'); } </script>
</head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TB_subject" runat="server" ondblclick="openWindow()"></asp:TextBox> <asp:TextBox ID="TB_Infor" runat="server"></asp:TextBox> </div> </form> </body> </html>
PopUp页面当中 Popup.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Popup.aspx.cs" Inherits="Popup" %> <!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"> <title>无标题页</title> <script type="text/javascript"> function popup() { window.opener.document.getElementById("TB_subject").value=document.getElementById("TB_Name").value; window.opener.document.getElementById("TB_Infor").value=document.getElementById("TB_Summary").value; window.close() } </script>
</head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TB_Name" runat="server"></asp:TextBox> <asp:TextBox ID="TB_Summary" runat="server"></asp:TextBox> <p> <input type="button" value="传值并返回父窗口" name="button1" onclick="popup()" /></p>
</div> </form> </body> </html>
来源:展洋科技 www.35544216.com
|