iframe自适应高度

function iFrameHeight() {
    var ifm = document.getElementById("mainframe");
    var subWeb = document.frames ? document.frames["mainframe"].document : ifm.contentDocument;
    if (ifm != null && subWeb != null) {
        ifm.height = subWeb.body.scrollHeight+15;
    }
}

 

posted @ 2014-10-24 15:28  kedarui  阅读(166)  评论(0编辑  收藏  举报