行业分类
实现iFrame自适应高度,原来很简单!
日期:2008-12-29 15:22  点击:772

<iframe id="iFrame1" name="iFrame1" width="100%" onload="this.height=iFrame1.document.body.scrollHeight" frameborder="0" src="index.htm"></iframe>

 

看到了吧,关键就在于onload="this.height=iFrame1.document.body.scrollHeight"! 

 

 

如果写在IFrame内容页中,

Parent.docuemnt.getElementById(’父页面的IFrameID’).height = document.body.scrollHeight;

 

 

写在 onload  onresize 事件中。

关于网站  |  普通版  |  触屏版  |  网页版
首页 刷新 顶部