惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
T
Threatpost
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
S
Securelist
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
S
Secure Thoughts
MyScale Blog
MyScale Blog
O
OpenAI News
P
Palo Alto Networks Blog
美团技术团队
C
Cyber Attacks, Cyber Crime and Cyber Security
TaoSecurity Blog
TaoSecurity Blog
量子位
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
Know Your Adversary
Know Your Adversary
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
宝玉的分享
宝玉的分享
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
S
Security @ Cisco Blogs
S
Schneier on Security
B
Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Cloudflare Blog
AWS News Blog
AWS News Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
H
Heimdal Security Blog
I
Intezer
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
W
WeLiveSecurity

博客园 - 曾伟

不干胶、热敏打印 wpf 滚屏数据显示 net core quartz调度 warp打包 nssm部署到windowsservice c# webapi 过滤器token、sign认证、访问日志 c# NPOI文件操作 c# ini文件操作 WCF多种调用方式兼容 网页打印javascript:window.print() ASP.NET] 选择文件夹的对话框 常用SQL语句书写技巧 控制同一exe程序打开多次 - 曾伟 - 博客园 IIS6 MMC检测到此管理单元发生一个错误,建议您关闭并重新启动mmc 在上传文件时限制上传文件的大小,并捕捉超过文件大小限制的 - 曾伟 - 博客园 Lucene的例子 javascript 获取标签具体位置 - 曾伟 - 博客园 JavaScript实现类,有多种方法。 Javascript实现截图功能(代码) 终端服务器超出了最大允许连接数 DBCC CHECKDB 数据库或表修复
window.showModalDialog弹出对话框刷新问题
曾伟 · 2011-10-22 · via 博客园 - 曾伟

window.showModalDialog弹出对话框刷新问题的总结

Posted on 2011-06-02 15:48 杨锐-->天柱山 阅读(31) 评论(0) 编辑 收藏 

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" />即可,有时候无效,需要换成<base target="_self"></base>