当前位置: 移动技术网 > IT编程>网页制作>CSS > [转]目前找到的最好的Iframe自适应高度代码

[转]目前找到的最好的Iframe自适应高度代码

2017年12月12日  | 移动技术网IT编程  | 我要评论
注:onload字段中的数值“200”为设置的iframe最低高度值!

当然iframe,html要在同一子域下才可以,否则警告没有权限.

<iframe src="iframe.html" name="iframe" id="iframe" allowtransparency="true" align="default" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" height="200" width="500" onload="this.height=0;var fdh=(this.document?this.document.body.scrollheight:this.contentdocument.body.offsetheight);this.height=(fdh>200?fdh:200)//code by tencent.nokersang">this message is only visible to older browsers.</iframe> 

这个脚本测试可以支持ie5.5,ie6.0,firefox1.x,opera9.01

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网