• iframe自适应高度


    经典代码 iFrame 自适应高度,在IE6/IE7/IE8/Firefox/Opera/Chrome/Safari通过测试。

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

    两个iframe嵌套的

    var ifm= document.getElementById("user_iframe");
        var subWeb = document.frames ? document.frames["user_iframe"].document : ifm.contentDocument;
        
        if(ifm != null && subWeb != null) {
           ifm.height = subWeb.body.scrollHeight;
        }
        
        //得到父iframe
        var ifmParent= window.parent.document.getElementById("main_iframe");
        var subWebParent = window.parent.document.frames ? window.parent.document.frames["main_iframe"].document : ifmParent.contentDocument;
        if(ifmParent != null && subWebParent != null){
            ifmParent.height = subWeb.body.scrollHeight;
        }

  • 相关阅读:
    Zend Guard 7 , Zend Guard Loader处理PHP加密
    [转]pHP源码加密方法调查
    使用USB Key(加密狗)实现身份认证
    4*4行列式矩阵键盘
    HDU-2546-饭卡
    HDU-2073-无限的路
    HDU-2065-"红色病毒"问题
    HDU-2063-过山车
    HDU-2060-Snooker
    HDU-2056-Rectangles
  • 原文地址:https://www.cnblogs.com/dingchenghong/p/2526441.html
Copyright © 2020-2023  润新知