另外: www.csdn.net 本人整理 问: 1.模态窗口的打开 2.模态窗口的关闭 3.模态窗口的传递参数。 4.其他。。。。 hgknight(江雨.net)答: 1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;"); 2.window.close(); 3.传值 ParentPage.aspx: window.showModalDialog("DialogPage.aspx?para1=aaa¶2=bbb"); DialogPage.aspx: string str1=Request.QueryString["para1"].toString(); string str2=Request.QueryString["para2"].toString(); 返回值 DialogPage.aspx: window.returnvalue="aaa"; ParentPage.aspx: var str=window.showModalDialog("DialogPage.aspx"); 4. aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面? showmodaldialog打开的页面中在<head></head>之间加入一行:<base target="_self"> -------------------------------------------- snowjin78(方圆) 以前,我也问过此类问题,现把收获贴如下(当然好多东西都是别人告诉我的): 最好不要用Response.Write( " <script. </script > ")这样的方法注册客户端脚本,而应该用Page.RegisterStartupScript或Page.RegisterClientScriptBlock方法来注册. Page.RegisterClientScriptBlock: 在 Page 对象的 <form runat= server > 元素的开始标记后立即发出客户端脚本 Page.RegisterStartupScript: 该方法在 Page 对象的 <form runat= server > 元素的结束标记之前发出该脚本 客户端代码有两个问题,第一是把window写成了Window,javascript是严格区分大小写的,用Window是肯定会出错的;第二个问题是设置对话框的宽度用dialogWidth,高度用dialogHeight,而不是height和width。! -------------------------------------------------------------------------------- 一个很有用例子: On the IE-HTML list sometime back, contributor Joe Fawcett provided another very interesting (and, to my knowledge, otherwise explicitly documented) way to pass data into and out of modal dialogs [1]. Essentially, you assign the "opener" [2] as the argument passed into the modal dialog box. This allows the modal dialog to directly update a variable in the "opener" document regardless of whether it also sets a returnValue. Briefly: "Opener" pseudo-code: --------------------- <html> <head> <title>Parent document</title> <script type="text/javascript"> var vTestData, vRv ; vTestData ="I am a rock" ; function fnShowModal()