如何从其中显示的页面增加容器页面的iframe高度

时间:2013-08-13 09:59:11

标签: javascript jquery html iframe

我有一个将在iframe中显示的应用程序。

<iframe src="http://localhost/xxxxx.aspx"></iframe>

此容器的高度和宽度为900px and 600px。 我希望我的应用程序全屏显示 所以现在可以改变容器iframe的高度和宽度吗? P.S iframe不在同一个项目中,所以

$("iframe").css("height","1000px")

不会作为另一个文件。

2 个答案:

答案 0 :(得分:0)

指定应用选择器的上下文:

 $("iframe", window.parent.document).css("height","1000px");

以下是使用不同文件的示例:http://www.css-arts.com/iframe_test/iframe_test.html

当iframe内容页面是父页面之外的其他域时,浏览器通常会阻止对iframe父目录的访问。如果是这种情况,你就没有机会。

答案 1 :(得分:0)

这样的事情怎么样:

<iframe src="http://adobe.com" style="border:0px #FFFFFF none;" name="myiFrame" scrolling="no" frameborder="1" marginheight="0px" marginwidth="0px" height="600px" width="900px"></iframe>