【发布时间】:2011-12-20 10:05:07
【问题描述】:
我正在使用以下页面在 iframe 中显示 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 的一些内页 更改父窗口 url 而不是在 iframe 中加载...
对于前 http://www.coolmath.com/ 在 iframe 中加载,但在浏览某些链接时会在父窗口中加载整个页面。
【问题讨论】:
标签: javascript iframe