zoukankan      html  css  js  c++  java
  • 关于 contentWindow, contentDocument

    contentWindow 兼容各个浏览器,可取得子窗口的 window 对象。

    contentDocument Firefox 支持,> ie8 的ie支持。可取得子窗口的 document 对象。

    function showIframeH(){
        var parentWin = parent.document.getElementById("test");
        if(!parentWin) return false;
        
        var sub = parentWin.contentWindow.document.getElementById("test2");
        if(!sub) return false;
        
        var thirdHeight = sub.contentWindow.document.body.offsetHeight; //第三层 body 对象
        
        sub.height = thirdHeight; //设置第二层 iframe 的高度
        
        var secondHeight = x.contentWindow.document.body.offsetHeight; //第二层 body 对象
        x.height = secondHeight; //设置第一层 iframe 的高度
        //alert(secondHeight);
        //alert('body: ' + x.contentDocument.body.offsetHeight + ' div:' + thirdHeight);
    }
  • 相关阅读:
    移动安全
    Photoshop笔记
    ARMv7 与 ARMv8对比
    centos系统 网络配置
    视频大文件压缩
    开发者必备Linux命令
    开发者必备Docker命令
    文件服务器minio
    Java 图片Base64
    socket
  • 原文地址:https://www.cnblogs.com/pigtail/p/2500889.html
Copyright © 2011-2022 走看看