如何让iframe的高度自适应父窗口的高度

来源:互联网 发布:华3 网络行为管理 编辑:程序博客网 时间:2024/05/01 08:16

给iframe添加属性onload="javascript:this.height=this.contentWindow.document.body.scrollHeight+30;"

如:

<Iframe src="<%= request.getContextPath() %>/listColumnAction.do" width="100%" style="_width: 100%;"
     height="100" scrolling="auto" frameborder="0" name="main" onload="javascript:this.height=this.contentWindow.document.body.scrollHeight+30;"></iframe>