在当前窗口中新打开窗口并将当前窗口关闭(asp.net版)
<script type=\"text/javascript\">var w=window.availWidth;var h=window.availHeight;oNewWin=window.open(\"panel.aspx\",\"w\",\"width=\" + screen.availWidth + \",height=\" + screen.availHeight + \",top=0,left=0,toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=no,resizable=no\");oNewWin.focus();window.opener=null;window.open(”,’_self’);window.close();</script>
其中window.opener=null;window.open(”,’_self’);window.close();是适用于各浏览器通用关闭脚本,ie6,ie7,ie8测试可用,便在firefox上却不起作用。原因是firefox默认不允许脚本进行关闭窗口(但可以关闭window.open的窗口),可更改firefox配置进行修改。
firefox打开about:config进入配置窗口。找到dom.allow_scripts_to_close_windows
.png)
双击更改其属性值为true即可。
No related posts.
以上关联文章由 Yet Another Related Posts Plugin 提供支持。
One Response
Javascript系列教程:面向对象讲解(一) « 体验盒子
28|六|2010 1[...] firefox的js关闭窗口不起作用? window.opener=null; window.open(”,’_self’);window.close();是适用于各浏览器通用关闭脚本,ie6,ie7,ie8测试可用,便在 firefox上却不起作用。原因是firefox默认不允许脚本进行关闭窗口(但可以关闭 window.open的窗口),可更改firefox配置进行修改。… [...]
Leave a reply