子窗口<%@ Page Language="C#" AutoEventWireup="true" CodeFile="child.aspx.cs" Inherits="reader_js_parentChild_child" %> <!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> <mce:script type="text/javascript"><!-- function f() { //parent.dialogArguments.document.getElementById("Text1").value="change";//这里的dialogArguments不可替换为window window.parent.dialogArguments.document.execCommand('Refresh');//dialogArguments即那个window window.close(); } // --></mce:script> </head> <body> <form id="form1" runat="server"> <div> <input type="button" value="刷新父窗口" οnclick="f()"/> </div> </form> </body> </html> 父窗口前台:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="parent.aspx.cs" Inherits="reader_js_parentChild_parent" %> <!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> <mce:script type="text/javascript"><!-- function showMdlDlg(){ window.showModalDialog("child.aspx",window,//window这里的参数不清楚其他 "dialogHeight: 150px; dialogWidth: 150px; dialogTop: 200px; dialogLeft: 200px; "+ "edge: Sunken; center: No; help: No; resizable: No; status: No;"); } // --></mce:script> </head> <body> <form id="form1" runat="server"> <div> <input id="Text1" type="text" /> <input οnclick="showMdlDlg();" value="控制显示" type="button" /> <input type="button" οnclick="window.showModalDialog('child.aspx',window)" value="模态窗口"/> <input type="button" οnclick="window.showModelessDialog('child.aspx',window)" value="非模态ff不支持"/> </div> </form> </body> </html> 父窗口后台:using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class reader_js_parentChild_parent : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Session["count"] != null) Session["count"] += "tree"; else Session["count"] = "hello"; Response.Write(Session["count"].ToString()); } }