我正在使用以下页面显示iframe中的url内容并根据输入值更改它。更改iframe url更改父窗口url
<html>
<head>
<script type="text/javascript">
function changeUrl()
{
var url=document.getElementById('browseurl').value;
if(url!="")
{
if(url.indexOf("http")==-1)
{
url="http://"+url;
}
document.getElementById('browserWnd').src=url;
}
}
</script>
</head>
<body>
<div >
<span>Url</span>
<input id="browseurl" name="browseurl" type='textbox' />
<input id="browse" type='button' value="changeurl" onclick="changeUrl()" />
</div>
<iframe id="browserWnd" src="http://www.coolmath.com/" height="700" width="625"></iframe>
</div>
</body>
</html>
我的问题是浏览iframe中加载了一个网址的一些内页改变父窗口的URL,而不是装载在IFRAME ...
为前HTTP:// WWW。 coolmath.com/在iframe中加载,但浏览一些链接时会在父窗口中加载整个页面。
但以下也没有自己或顶部做同样的事情。 http://www.woodlands-junior.kent.sch.uk/maths/ – ArK 2011-12-20 10:14:01
@Paniyar你提供的链接*有*自己和'顶部'。代码是: '' – 2011-12-20 15:11:52