admin管理员组文章数量:1394770
I have parent page index.php and inside it i have iframe like below
<div id="main-content1" style="position:absolute;float:none;top:80px;margin-left:170px;width: 830px;">
<iframe onload="IfarmeOnload();" style="display:block; margin-left:none; margin-right:none; width: 100%; height: 100%;" src="<?php echo $home; ?>" id="rightMenu" name="rightMenu" frameborder="0"></iframe>
</div>
when i click on the link that located in Parent window i want to redirect iframe content to according to that URL.
Then once Iframe loaded sucessfully i want redirect whole index.php page only once
EDIT
i tried this
echo "<script> document.getElementById('rightMenu').contentWindow.location=''</script>";
but this is redirecting to google.lk to not loading inside the ifamme
I have parent page index.php and inside it i have iframe like below
<div id="main-content1" style="position:absolute;float:none;top:80px;margin-left:170px;width: 830px;">
<iframe onload="IfarmeOnload();" style="display:block; margin-left:none; margin-right:none; width: 100%; height: 100%;" src="<?php echo $home; ?>" id="rightMenu" name="rightMenu" frameborder="0"></iframe>
</div>
when i click on the link that located in Parent window i want to redirect iframe content to according to that URL.
Then once Iframe loaded sucessfully i want redirect whole index.php page only once
EDIT
i tried this
echo "<script> document.getElementById('rightMenu').contentWindow.location='http://www.google.lk'</script>";
but this is redirecting to google.lk to not loading inside the ifamme
Share Improve this question edited Sep 19, 2011 at 5:14 Roshan Wijesena asked Sep 19, 2011 at 4:54 Roshan WijesenaRoshan Wijesena 3,1369 gold badges40 silver badges58 bronze badges 2- 2 iframes are dated there are much better solutions such as ajax – user557846 Commented Sep 19, 2011 at 5:16
- 1 yes true but this moment i have no options – Roshan Wijesena Commented Sep 19, 2011 at 5:17
2 Answers
Reset to default 6Give your iframe
a name:
<iframe name="myIframeName"></iframe>
Reference your iframe
in desired hyperlinks with the target
attribute:
<a href="/path/to/page.php" target="myIframeName"></a>
I do not seat by the puter but I think You need something like that Document.getElementById("rightMenu").location.href
Or try this one iframeobj.src = url
Or the same code that you wrote but without contentwindow
本文标签: javascriptHow to redirect Iframe to another URL phpStack Overflow
版权声明:本文标题:javascript - How to redirect Iframe to another URL php - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744103435a2590965.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论