admin管理员组文章数量:1208155
I have this code, to navigate a URL with javascript in an iframe, but it does not work. Why?
For example, I want navigate to site
when I click link1.
<script language="javascript">
function nav()
{
window.navigate('',target="DBox");
}
</script>
<a href="javascript:nav();">link1</a>
<iframe name="DBox" src="http://example" frameborder="0" style="width:100%;height:100%"></iframe>
I have this code, to navigate a URL with javascript in an iframe, but it does not work. Why?
For example, I want navigate to site.com
when I click link1.
<script language="javascript">
function nav()
{
window.navigate('http://site.com',target="DBox");
}
</script>
<a href="javascript:nav();">link1</a>
<iframe name="DBox" src="http://example" frameborder="0" style="width:100%;height:100%"></iframe>
Share
Improve this question
edited Sep 11, 2013 at 15:20
123
5251 gold badge5 silver badges20 bronze badges
asked Jan 2, 2012 at 14:57
returnreturn
1,0495 gold badges17 silver badges28 bronze badges
2 Answers
Reset to default 18Simple HTML:
<a target="DBox" href="http://site.com">link1</a>
Or with just call this with JavaScript:
window.open("http://site.com", "DBox");
This will be navigate to url in the same window.
window.top.location.href = "http://example.com";
本文标签: htmlNavigate URL in iframe with JavascriptStack Overflow
版权声明:本文标题:html - Navigate URL in iframe with Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738680105a2106500.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论