实现iFrame自适应高度,原来很简单!
2010-10-21 13:16
<
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"!
看到了吧,关键就在于onload="this.height=iFrame1.document.body.scrollHeight"!
本文介绍了一种简单的方法来实现iFrame的高度自适应。通过设置onload事件为this.height=iFrame1.document.body.scrollHeight,可以使iFrame的内容区域高度随着内容的变化而自动调整。
2404

被折叠的 条评论
为什么被折叠?



