window.showModalDialog刷新父窗口和本窗口的方法及注意:
一.刷新父窗口的方法:
A.使用window.returnValue给父窗口传值,然后根据值判断是否刷新。
在window.showModalDialog窗口页面中用window.returnValue方式设置返回值;
比如:window.returnValue='refresh';
B。在写window.showModalDialog弹出窗口函数时,定义个变量,然后根据变量值进行操作父窗口的操作;
例如:var winPar=window.showModalDialog(urls,'ERPWINDOWS','dialogWidth='+widths+'px;dialogHeight='+heigths+'px;status=no;center=yes;scroll=no');
if(winPar == "refresh")
window.location.reload();//当window.showModalDialog窗口关闭时执行
winPar为A步骤给showModalDialog窗口设置的返回值
总结:由于window.showModalDialog函数打开一个IE的模式窗口(就是打开后不能操作父窗口,只能等模式窗口关闭时才能操作),
所以想要刷新父窗口只能在模式窗口关闭后执行。用window.returnValue可以向父窗口传值,这样一来可以用从模式窗口向父窗口传递值,
然后根据值判断操作父窗口的方式来刷新。这样在任何关闭了模式窗口后父窗口都会自动刷新.
二.刷新模式本窗口
showModalDialog窗口与window.open打开的窗口刷新本窗口时不同,showModalDialo窗口也不能用F5刷新,也没有右键操作
A. 在模式窗口页面中加入:
<base target="_self"> //在html和body之间
<a id="reload" href="本页面url" style="display:none"></a>
B. 在需要执行刷新操作的地方执行以下js:
reload.click();//reload为A中隐藏a标签的id,当然可以换成其它名称
三。注意事项
在点击window.showModalDialog窗口的链接的时候会打开新窗口,想要阻止打开新窗口,需要在窗口页面中的html和body之间
加入: <base target="_self" />即可
文章来自:http://blog.csdn.net/cuizhihuaking/article/details/6622077
文章来自:http://www.blogjava.net/zlpgm/archive/2010/05/12/320670.html
分享到:
相关推荐
This is a `window.showModalDialog()` shim using a modal HTML5 `<dialog>` element and ECMAScript 6 Generators. It was tested in the latest Google Chrome with the *Enable Experimental JavaScript* flag ...
window.showModalDialog以及window.open用法简介
NULL 博文链接:https://shawnfree.iteye.com/blog/598885
针对window.showmodaldialog弹出窗体无刷新的详细使用
window.showModalDialog以及window.open用法简介
关于struts2里用javascript刷新window.showModalDialog的父页面
javascript代码模块之\Window.ShowModalDialog使用手册
window.showModalDialog的基本用法
showModalDialog刷新窗口的例子
使用window.showModalDialog的程序员都知道,该方法可返回值。但是如果遇到跨域时,就返回为underfine。本文档通过iframe镶嵌页面解决该问题。
window.showModalDialog&&open.docx
网上找了好几个小时没有找到解决办法。最终还是自己解决了。...这样做就是用超链接把返回url转递到用showModalDialog打开的新窗口中,当showModalDialog返回时指到转来的url,最终不刷新父窗口。......
主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.
1> window.showModalDialog()采用JS原理实现,同时父窗口不可操作,window.open()采用新创建一个窗口,同时父窗口可操作; 2> 父窗口与子窗口传递值的方式也有所不同,在子窗口中操作父窗口也语法也不同,分别为var...
javascript代码模块之window.showModalDialog方法的使用
Window.ShowModalDialog使用手册_对话框 .txt 详细
ShowModalDialog函数的功能: 使用方法: 参数说明:
JS 弹出对话框window.showModalDialog,级联方式,可以返回传值给页面