2010-11-24 90 views
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。

回答

0

这看起来像是Chrome Mac的本地问题。我没有在测试mac上安装web服务器,但是当我将这些文件上传到服务器并从那里查看时,一切似乎都奏效。

谢谢,

Jayde。

相关问题