<script type="text/javascript">google_ad_client = "pub-2048279401139630";google_ad_slot = "8856771542";google_ad_width = 728;google_ad_height = 90;document.write("<s"+"cript type='text/javascript' s"+"rc='http://pagead2.googlesyndication.com/pagead/show_ads"+"."+"js'></scr"+"ipt>");</script>
<
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
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的高度自适应。通过设置onload事件为iFrame的高度等于其内容的实际高度,可以使得iFrame能够根据内部文档的高度进行自动调整。
182

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



