iframe 高度自动调节,最简单解决

iFrame高度自动调节,好象是个难题耶。
GOOGLE一下,方法一大堆,有点太复杂,都不大行。
vs2008的帮助又动不了,连看个iframe类模型都无办法,菜啊。

试了N回,下面简单代码可以了,asp.net 2.0条件下。

<iframe id="content" name="content" scrolling="no" frameborder="0" width="754px" height="50px"     onload = "height = this.Document.body.scrollHeight + 30;" >   </iframe>

注意事项
1、height设为auto不行的,一定要有一个值
2、this.document引用到是的 iframe所在页面对象,
      this.Document (大写D),才能引用到iframe内含对象

这个方法可能更稳妥
 onload = "height = document.frames(this.name).document.body.scrollHeight + 30"

原文地址:https://www.cnblogs.com/zhwl/p/2383343.html