iframe 高度自动调节

<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"
posted @ 2010-05-24 15:07  努力偷懒  阅读(240)  评论(1编辑  收藏  举报