当前位置: 代码迷 >> Web前端 >> 简略iframe高度自适应代码
  详细解决方案

简略iframe高度自适应代码

热度:63   发布时间:2012-10-26 10:30:59.0
简单iframe高度自适应代码
1 js函数
function adjustFrameHeight(obj) {
     	var doc = obj.document||obj.contentWindow.document;
     	obj.height=doc.documentElement.scrollHeight;
}


2 html代码样例
 
<iframe src="url" onload="adjustFrameHeight(this);"></iframe>


以上代码兼容ie,firefox
  相关解决方案