我有一个iframe,我试图根据它的实际内容调整它的大小(就像我没有得到任何滚动一样)。我试过以下内容:Firefox:根据实际内容调整iframe的大小
alert(document.getElementById(iframe).contentWindow.document.body.height); alert(document.getElementById(iframe).contentWindow.document.body.scrollHeight); alert(document.getElementById(iframe).contentWindow.document.body.offsetHeight);
没有那些工作。 iframe包含iframe的ID。最后两行在Chrome中运行。
任何帮助将非常感激。
这两个文档都在同一个域上吗? – tomsv
Yeap - 同一个 – Yannis
这个问题的重复? http://stackoverflow.com/questions/11806947/is-it-possible-that-iframe-resize-itself-without-help-from-main-window – Juffy