首页 > 其他 > 详细

iframe 高度自适应

时间:2019-04-15 11:06:53      阅读:160      评论:0      收藏:0      [点我收藏+]

 

<iframe id="InputDetail" src style="width:100%"></iframe>
<script>//iframe高度自适应,方法
function reinitIframe(thisIframe)
{
    var iframe = document.getElementById(thisIframe);
    try
    {
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height = height;
        //console.log(height);
    }
    catch (ex)
        {}
}
window.setInterval("reinitIframe(‘InputDetail‘)", 200);
</script>

参考博客:iframe高度自适应的6个方法

iframe 高度自适应

原文:https://www.cnblogs.com/dyhao/p/10709213.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!