iframe ie下自动适应高度

来源:互联网 发布:怎么找到淘宝联盟社区 编辑:程序博客网 时间:2024/05/16 17:07
 

        function reinitIframe() {

            var iframe = document.getElementById("frmContent");

            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);

原创粉丝点击