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

推荐订阅源

D
Docker
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
量子位
T
Tailwind CSS Blog
T
Threatpost
The GitHub Blog
The GitHub Blog
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
P
Proofpoint News Feed
博客园 - 司徒正美
L
LangChain Blog
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
S
Secure Thoughts
The Last Watchdog
The Last Watchdog
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
T
Troy Hunt's Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
W
WeLiveSecurity
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
T
Tor Project blog
T
The Blog of Author Tim Ferriss
I
Intezer
P
Privacy & Cybersecurity Law Blog
美团技术团队
N
Netflix TechBlog - Medium
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
Google Developers Blog
Attack and Defense Labs
Attack and Defense Labs
T
Tenable Blog
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
腾讯CDC
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
Last Week in AI
Last Week in AI

博客园 - 新人~

有没有靠谱的论文查重网站? 潘正磊谈微软研发团队管理之道(下) 潘正磊谈微软研发团队管理之道(上) 22个所见即所得在线 Web 编辑器 重启ASP.NET应用程序 神奇的js代码,图片全都飞起来了 只允许输入数字 软件项目开发典型风险一览 通用防SQL注入漏洞程序(Global.asax方式) 删除数据库所有表数据 将Excel工作薄事件封装到COM加载项中 追MM与23种设计模式 今天愚人节,教大家一个真正的最强整人方法 字体 小 中 大 剪切上传图片源码 C#在网页中关闭重启服务 低调做人,高调做事 《老婆1.0版》答疑 asp.net 防止图片被其它网站盗链
JavaScript技巧——js关闭窗口无提示
新人~ · 2009-09-17 · via 博客园 - 新人~

js关闭窗口无提示

在不是js打开的页面上按window.close(), 会有提示框,很烦,现在可以不用了,没有提示框直接关闭窗口。
试试下面代码:

<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<input type="button" name="Button" value="关闭窗口" onClick="document.all.WebBrowser.ExecWB(45,1)">
试着改变参数会得到其他一些功能:

WebBrowser.ExecWB(1,1) 打开
WebBrowser.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
WebBrowser.ExecWB(4,1) 保存网页
WebBrowser.ExecWB(6,1) 打印
WebBrowser.ExecWB(7,1) 打印预览
WebBrowser.ExecWB(8,1) 打印页面设置
WebBrowser.ExecWB(10,1) 查看页面属性
WebBrowser.ExecWB(15,1) 好像是撤销,有待确认
WebBrowser.ExecWB(17,1) 全选
WebBrowser.ExecWB(22,1) 刷新
WebBrowser.ExecWB(45,1) 关闭窗体无提示

另一种关闭窗口无提示的方法:

<input type="button" value="没有提示关闭" onclick="window.opener=null;window.close();" />

同样的语句,在IE6下很正常,在IE7下就弹出要关闭窗口前的提示。很简单,请使用这段代码:
<a href="#" onclick="window.opener=null;window.open('','_self');window.close();" >不确认关闭 </a >
也就是在window.opener=null;window.close()之间加入window.open('','_self');
就OK了!

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/liangweiwei130/archive/2008/11/05/3226602.aspx