我在使用 Google Chrome 时似乎遇到了 iFrame 调整大小问题。
> <script language="javascript" type="text/javascript">
function resizeIframe(obj)
{
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
</script>
<
这在我的标题中。
> <iframe id="content" name="content" frameborder="0" scrolling="no" width="950px" src="html/index2.html" onload='javascript:resizeIframe(this);'></iframe> <
这是我的 iframe 脚本。
所以我想做的是动态调整每个页面内容的 iFrame 大小,并且它在 Firefox 和 IE 中完美运行,但在 Chrome 中则不行。是什么赋予了?大家有什么想法吗?
提前致谢。
最佳答案
看来这是一个bug with chrome 。为什么现在不能使用 clientHeight 来代替scrollHeight?
关于javascript - 谷歌浏览器中的动态 iframe 调整大小问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3898684/