<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="parentFrm.aspx.cs" Inherits="www.modalDlg.parentFrm" %> <!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(){ var url="childFrm.aspx?id=10"; var obj=window.showModalDialog(url,'','dialogWidth:650px;dialogHeight:420px;status:no;scroll:no'); if(obj!=null) { alert(obj.id+obj.name); } } // --></mce:script> </head> <body> <form id="form1" runat="server"> <div> <input id="btnShow" type="button" value="模式窗体" οnclick="showMdlDlg();" /> </div> </form> </body> </html> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="childFrm.aspx.cs" Inherits="www.modalDlg.childFrm" %> <!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 fOk(){ var obj=new Object(); obj.id='<%=Request.QueryString["id"] %>'; obj.name="tree"; window.returnValue=obj; window.close(); } // --></mce:script> </head> <body> <form id="form1" runat="server"> <div> <input id="btnOk" type="button" value="Ok" οnclick="fOk();" /> </div> </form> </body> </html>