如果网页不是通过脚本程序打开的(window.open()),调用window.close()脚本关闭窗口前,必须先将window.opener对象置为null,否则浏览器(IE7、IE8)会弹出一个确定关闭的对话框。
<script language="javaScript">
function closeWindow()
{
window.opener = null;
window.open(' ', '_self', ' ');
window.close();
}
</script>
<input type='button' value='关闭窗口' onClick="closeWindow()">
或
<input type="button" value="关闭窗口" onClick="window.opener = null; window.open(' ', '_self', ' ');window.close()">
对于关闭框架窗口
<script language="javaScript">
function closeWindow()
{
window.opener = null;
window.open('', '_top', '');
window.parent.close();
}
</script>
0
0
2018.9.21 Codeforces Round #511(Div.2)
2018.9.20 Educational Codeforces Round 51
解题:USACO12OPEN Bookshelf
解题:CF983B pyramid
1214. 许可证密钥格式
1212. 最大连续1的个数
1270. 勒索信
1250. 第三大的数
1218. 补数