使用javascript在Iframe中显示url
要求小,有一个iframe,后面有3个按钮。 单击按钮1后,url应显示在iframe中,与第二个按钮相同。 这是我的密码,你能帮我吗使用javascript在Iframe中显示url,javascript,iframe,Javascript,Iframe,要求小,有一个iframe,后面有3个按钮。 单击按钮1后,url应显示在iframe中,与第二个按钮相同。 这是我的密码,你能帮我吗 function testCoverage(){ window.frames['idIfrm'].document.location.href = 'http://google.com'; } function testCoverage1(){ window.frames['idIfrm'].document.locati
function testCoverage(){
window.frames['idIfrm'].document.location.href = 'http://google.com';
}
function testCoverage1(){
window.frames['idIfrm'].document.location.href = 'http://yahoo.com';
}
这里有一个问题,您的小提琴没有运行,因为它被设置为运行JavaScript onload,而不是在头部。更改左上角的下拉列表 第二个问题,您应该设置iframe的源,而不是文档位置
window.frames['idIfrm'].src = "foo.html";
第三个你无能为力的问题是谷歌和雅虎不能被纳入iframe。您将得到错误
拒绝在帧中显示“”,因为它设置为
“X-Frame-Options”到“SAMEORIGIN”
好吧,你的小提琴没有运行,因为它被设置为运行JavaScript加载,而不是在头部。更改左上角的下拉列表 第二个问题,您应该设置iframe的源,而不是文档位置
window.frames['idIfrm'].src = "foo.html";
第三个你无能为力的问题是谷歌和雅虎不能被纳入iframe。您将得到错误
拒绝在帧中显示“”,因为它设置为
“X-Frame-Options”到“SAMEORIGIN”
好吧,你的小提琴没有运行,因为它被设置为运行JavaScript加载,而不是在头部。更改左上角的下拉列表 第二个问题,您应该设置iframe的源,而不是文档位置
window.frames['idIfrm'].src = "foo.html";
第三个你无能为力的问题是谷歌和雅虎不能被纳入iframe。您将得到错误
拒绝在帧中显示“”,因为它设置为
“X-Frame-Options”到“SAMEORIGIN”
好吧,你的小提琴没有运行,因为它被设置为运行JavaScript加载,而不是在头部。更改左上角的下拉列表 第二个问题,您应该设置iframe的源,而不是文档位置
window.frames['idIfrm'].src = "foo.html";
第三个你无能为力的问题是谷歌和雅虎不能被纳入iframe。您将得到错误
拒绝在帧中显示“”,因为它设置为
“X-Frame-Options”到“SAMEORIGIN”
您应该使用src属性。您的代码应该如下所示
function testCoverage(){
document.getElementById['idIfrm'].src = 'http://google.com';
}
function testCoverage1(){
document.getElementById['idIfrm'].src = 'http://yahoo.com';
}
您应该使用src属性。您的代码应该如下所示
function testCoverage(){
document.getElementById['idIfrm'].src = 'http://google.com';
}
function testCoverage1(){
document.getElementById['idIfrm'].src = 'http://yahoo.com';
}
您应该使用src属性。您的代码应该如下所示
function testCoverage(){
document.getElementById['idIfrm'].src = 'http://google.com';
}
function testCoverage1(){
document.getElementById['idIfrm'].src = 'http://yahoo.com';
}
您应该使用src属性。您的代码应该如下所示
function testCoverage(){
document.getElementById['idIfrm'].src = 'http://google.com';
}
function testCoverage1(){
document.getElementById['idIfrm'].src = 'http://yahoo.com';
}
请尝试一下这个代码,它在我这边运行得很好
<div>
<button><a href="http://www.computerhope.com/banners/banner.gif" target="iframe_a">Banner1</a></button>
<button><a href="http://www.computerhope.com/banners/banner2.gif" target="iframe_a">Banner2</a></button>
<button><a href="http://www.computerhope.com/banners/banner3.gif" target="iframe_a" onclick="closeWindow();">Banner3</a></button>
<div>
<iframe src="http://www.computerhope.com/banners/banner3.gif" name="iframe_a" width="900" height="350px" id="iframe" frameborder="0" scrolling="no" style="margin-left:15px;margin-bottom:15px;border:none;">
</iframe>
</div>
</div>
请尝试此代码,它在我这边运行良好
<div>
<button><a href="http://www.computerhope.com/banners/banner.gif" target="iframe_a">Banner1</a></button>
<button><a href="http://www.computerhope.com/banners/banner2.gif" target="iframe_a">Banner2</a></button>
<button><a href="http://www.computerhope.com/banners/banner3.gif" target="iframe_a" onclick="closeWindow();">Banner3</a></button>
<div>
<iframe src="http://www.computerhope.com/banners/banner3.gif" name="iframe_a" width="900" height="350px" id="iframe" frameborder="0" scrolling="no" style="margin-left:15px;margin-bottom:15px;border:none;">
</iframe>
</div>
</div>
请尝试此代码,它在我这边运行良好
<div>
<button><a href="http://www.computerhope.com/banners/banner.gif" target="iframe_a">Banner1</a></button>
<button><a href="http://www.computerhope.com/banners/banner2.gif" target="iframe_a">Banner2</a></button>
<button><a href="http://www.computerhope.com/banners/banner3.gif" target="iframe_a" onclick="closeWindow();">Banner3</a></button>
<div>
<iframe src="http://www.computerhope.com/banners/banner3.gif" name="iframe_a" width="900" height="350px" id="iframe" frameborder="0" scrolling="no" style="margin-left:15px;margin-bottom:15px;border:none;">
</iframe>
</div>
</div>
请尝试此代码,它在我这边运行良好
<div>
<button><a href="http://www.computerhope.com/banners/banner.gif" target="iframe_a">Banner1</a></button>
<button><a href="http://www.computerhope.com/banners/banner2.gif" target="iframe_a">Banner2</a></button>
<button><a href="http://www.computerhope.com/banners/banner3.gif" target="iframe_a" onclick="closeWindow();">Banner3</a></button>
<div>
<iframe src="http://www.computerhope.com/banners/banner3.gif" name="iframe_a" width="900" height="350px" id="iframe" frameborder="0" scrolling="no" style="margin-left:15px;margin-bottom:15px;border:none;">
</iframe>
</div>
</div>