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

相關問題