首页 > 其他 > 详细

iframe自适应内容高度

时间:2014-10-08 10:55:05      阅读:330      评论:0      收藏:0      [点我收藏+]

onload="this.height=this.contentWindow.document.body.scrollHeight"

/**
*上传控件iframe自适应
**/
function iframeautoHeight(obj, frameObj) {
    if (document.all) {
        if (frameObj) {
            obj.height = document.getElementById(frameObj).contentWindow.document.body.scrollHeight;
            obj.width = document.getElementById(frameObj).contentWindow.document.body.scrollWidth;
        } else {
            obj.height = obj.contentWindow.document.body.scrollHeight;
            obj.width = obj.contentWindow.document.body.scrollWidth;
        }
    } else {
        if (frameObj) {
            obj.height = document.getElementById(frameObj).contentWindow.document.body.offsetHeight;
            obj.width = document.getElementById(frameObj).contentWindow.document.body.clientWidth;
        } else {
            obj.height = obj.contentWindow.document.body.offsetHeight;
            obj.width = obj.contentWindow.document.body.clientWidth;
        }
    }
}

iframe自适应内容高度

原文:http://www.cnblogs.com/miumiu/p/4010612.html

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