[英]Redirect iframe from parent page
我有疑问,如何从他的父页面重定向 iframe? 我有这个
if(($mypassword == "home.guava")) {
echo "<script>window.top.location.href = \"teste\";</script>";
}
在我的 php 文件中,该文件附加到 iframe 页面。 但我需要的是这样的东西,它将从父页面重定向 iframe!
谢谢大家:D
如果脚本在父级中,则不必有问题。
if(($mypassword == "home.guava")) {
echo "<script>document.getElementsByTagName('iframe')[0].src = \"teste\";</script>";
}
例子:
<body>
<iframe id="one" src="url"></iframe>
<iframe id="two" src="url"></iframe>
</body>
// Parent to child:
document.getElementsById('one').src = url;
// Child to parent
window.parent.location.href = url;
// Child to other child
window.parent.document.getElementById('two').src = url;
// Current (Child or Parent)
window.location.href = url;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.