当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript showModalDialog 多层模态窗口实现页面提交及刷新的代码

Javascript
[IE&FireFox兼容]JS对select操作
JS实现全景图效果360度旋转
Unicode 编码转换器
如何用javascript判断录入的日期是否合法
图片从右至左滚动JS
JS控件autocomplete 0.11演示及下载 1月5日已更新
一个对于js this关键字的问题
Javascript标准DOM Range操作全集
兼容Mozilla必须知道的知识。
你所要知道JS(DHTML)中的一些技巧
JS效率个人经验谈(8-15更新),加入range技巧
如何让动态插入的javascript脚本代码跑起来。
Javascript调试工具(下载)
脚本中出现 window.open() access is denied - 拒绝访问 情况一则及分析
Javascript-Mozilla和IE中的一个函数直接量的问题
贴一个在Mozilla中常用的Javascript代码
Javascript miscellanea -display data real time, using window.status
js技巧--转义符"\"的妙用
In Javascript Class, how to call the prototype method.(three method)
Javascript与vbscript数据共享

Javascript 中的 javascript showModalDialog 多层模态窗口实现页面提交及刷新的代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 209 ::
收藏到网摘: n/a

javascript 多层模态窗口showModalDialog页面提交及刷新 在第N(N>1)层的模态页面中,如果想链接到其他页面或者刷新当前页,只能用
window.name = "__self";
window.open(window.location.href, "__self") //注意是2个下划线
替换 location.href
当需要关闭第N(N>1)层的模态窗口,并刷新第N-1层的模态页面时, 为防止刷新时弹出新窗口, 可以通过returnValue 以传递返回值给第N-1层模态窗口,来确认是否需要刷新
在按钮的提交事件中:
代码
复制代码 代码如下:

Response.Write("<script language='javascript'> ");
Response.Write("var w;if(window.dialogArguments != null) w = window.dialogArguments;");
Response.Write("window.returnValue=1;window.close();");
Response.Write("</script>");

在第N-1层模态窗口内控制模态窗口的弹出并确认是否需要刷新该页面
代码
复制代码 代码如下:

<script type="text/javascript">
function OpenShowDialog(id) {
var isReflesh = window.showModalDialog('Test.aspx?id=' + id, window, 'dialogWidth=670px;dialogHeight=250px;status:no;directories:yes;scrollbar:no;Resizable:no');
if (isReflesh == 1) {
window.name = "__self";
window.open(window.location.href, "__self")
}
}
</script>