1

我正在使用 iframe 显示一些内容。在其中一个页面上,它打开一个应该打印的弹出窗口。在我关闭此窗口后,它应该重定向到开始,但在 iframe 中。我怎样才能做到这一点?Acutally 它没有在 iframe 中重定向,它改变了父级。

我的代码

<iframe src="login.php" width="950px" height="600px" frameborder="0">

这是 onunload 函数,它应该改变 iframe 的内容。

<script>
window.onunload = function(){
var iframe = opener.parent.querySelector("iframe");
iframe.contentDocument.location.href = "index.html";
// opener.open("index.html"); 
}
</script>
4

0 回答 0