首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

FF没法通过window.close()关闭窗口

2013-08-10 
FF无法通过window.close()关闭窗口下面这种脚本的方法只是将当前窗口的地址变成空页面,而不是真正关闭窗口

FF无法通过window.close()关闭窗口
下面这种脚本的方法只是将当前窗口的地址变成空页面,而不是真正关闭窗口。FF下必须更改config,才能通过脚本关闭窗口。

<script>

function closeMe()
{
var win=window.open("","_self");
win.close();
}
</script>

<html>
<body>
<form>
<input type="button" name="Close"
onclick="closeMe()" />
</form>
</body>
</html>
We can also write script like this
function winClose()
{
window.top.opener=null;
window.close();
}

or

function closeWindow()
{
window.open('','_parent','');
window.close();
}


如果你使用的是firefox浏览器必须要做以下设置
1、在地址栏输入about:config然后回车,警告确认
2、在过滤器中输入”dom.allow_scripts_to_close_windows“,双击即可将此值设为true

热点排行