0
我想访问iframe的父窗口并设置iframe的高度。Mac谷歌Chrome浏览器iframe访问父窗口
以下代码适用于Windows IE7/IE8/Chrome/FireFox 3.6和Mac FireFox/Safari。
但在Mac Chrome它似乎没有访问父窗口。
在父页面我有一个iframe:
<iframe src="iframe_saleinfo.html" id="saleInformationIframe" frameborder="0"></iframe>
在Iframe.html的:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', window.top.document);
theFrame.height($(document.body).height() + 30);
});
我也曾尝试:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', top.document);
theFrame.height($(document.body).height() + 30);
});
我累了:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', parent.document.body);
theFrame.height($(document.body).height() + 30);
});
而且我想:提前
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', window.parent.document);
theFrame.height($(document.body).height() + 30);
});
感谢,
Jayde。