Iframe自适应高度绝对好使的代码 兼容IE,遨游,火狐
更新时间:2011年01月27日 13:37:05 作者:
我要评论

Iframe自适应高度绝对好使的代码IE,遨游,火狐都兼容,需要的朋友可以参考下。
复制代码 代码如下:
<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("mainFrame");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>
您可能感兴趣的文章:
相关文章
深入理解JavaScript和TypeScript中的class
class 声明创建一个基于原型继承的具有给定名称的新类,下面这篇文章主要给大家介绍了关于JavaScript和TypeScript中class的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考下。2018-04-04
最新评论