我想使用iframe在彈出窗口中顯示遠程URL的內容或網站。但我不想修復iframe的高度。我已經使用了一些代碼使用動態高度創建iframe
function resizeIframe(iframe) {
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
爲
,我曾嘗試另一個代碼
document.getElementById('iframe1').scrollHeight();
但是,這是行不通的。 請建議
檢查我的答案在http://stackoverflow.com/questions/20541182/html5-resize-top-level-document-iframe-from-inside-a-nested-iframe/20541967# 20541967 – RononDex
已檢查,但不適用於我。 –