test1.aspx页面的listbox的值,传到test2.aspx的textbox中
test1.aspx页面代码
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
- <!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>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <script type="text/javascript">
- function openChild()
- {
- var k = window.showModalDialog ("../test2.aspx",window, "dialogWidth:395px;status:no;dialogHeight:495px");
- }
- </script>
- <asp:ListBox ID="lstSjr" runat="server">
- <asp:ListItem Selected="True" Value="abc"></asp:ListItem>
- <asp:ListItem Value="cc"></asp:ListItem>
- </asp:ListBox>
- <input id="Button2" type="button" onclick="openChild()" value="button" />
- </div>
- </form>
- </body>
- </html>
test2.aspx页面代码
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>
- <!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>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <input id="txtSxr" type="text" />
- <script language="javascript" type="text/javascript">
- var k = window.dialogArguments;
- document.getElementById("txtSxr").value = k.document.getElementById("lstSjr").value;
- </script>
- </div>
- </form>
- </body>
- </html>