我正在尝试使用JavaScript从子窗口关闭父窗口,但它无法正常工作。
如果您有任何代码,请与我分享。
我的父HTML:
<script>
var winr;
var selfw;
function openAn(){
selfw=self.window;
winr=window.open("shell.htm","");
}
function justClose(){
//setTimeout("closeAfterMin()",2000);
winr.close();
}
function closeAfterMin(){
alert("sd");
selfw.close();
}
</script>
<body onload='openAn()' >
<h1>New Web Project Page</h1>
</body>
我的孩子 HTML:
<script>
function closeAll(){
window.parent.close();
}
</script>
<body>
<div onclick="closeAll();" onunload="window.opener.close();">
Close Parent and self
</div>
</body>
请帮助我...
iframe
?并且你想在iframe
中关闭父窗口? - steveyang