关于模态窗口(showModalDialog)

[ 关于模态窗口(showModalDialog)]

1.模态窗口的打开
2.模态窗口的关闭
3.模态窗口的传递参数。
4.其他。。。。


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&para2=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">
应该是页面缓存了吧
模式窗口有这个问题

解决如下:
添加
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
或者
在aspx文件头添加
<%@ OutputCache Duration="1" VaryByParam="None" %>
为了防止缓存,可以在页面的顶端添加 Response.Expires = -1
使用java提供的方法,在jsp或者servlet中都可以 <% response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache"); response.setDateHeader("Expires", 0);
 %> 使用HTML标记,如下面: <HEAD> <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="0">
</HEAD>

posted on 2009-04-03 17:41  自由人  阅读(218)  评论(0编辑  收藏  举报

导航