zoukankan      html  css  js  c++  java
  • iFrame根据里面的内容给高度,

    <iframe src="member/membercenteraction"  frameborder="0"  scrolling="no" name="iframepage" width="100%" id="iframepage" onload="this.height=400"></iframe>
    

      

    function iFrameHeight() {
      var iframe = document.getElementById("iframepage");
      var bHeight = iframe.contentWindow.document.body.scrollHeight;
      var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
      var height = Math.max(bHeight, dHeight);
      iframe.height = height;
    }
    window.setInterval("iFrameHeight()", 200);

    不过我觉得这样效果并不好~~

    <iframe src="member/membercenteraction"  frameborder="0"  scrolling="no" name="iframepage" width="100%" id="iframepage" onload="iFrameHeight()"></iframe>
    function iFrameHeight() {
        var ifm= document.getElementById("iframepage");
        var subWeb=window.frames["iframepage"]. contentDocument || window.frames["iframepage"]. contentWindow.document;
        var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
        if(ifm != null && subWeb != null) {
            ifm.height = subWeb.body.scrollHeight;
        }
    }
    window.setInterval("iFrameHeight()", 200);

    这种有的页面行,有的不行~搞不懂~~~

  • 相关阅读:
    python+selenium初学者常见问题处理
    pycharm的这些配置,你都知道吗
    巧用浏览器F12调试器定位系统前后端bug
    dsu + lca
    indeed2017校招在线编程题(网测)三
    rolling hash
    ac自动机
    indeed 第二次笔试题
    vmware以及schlumberger题解
    2017 google Round C APAC Test 题解
  • 原文地址:https://www.cnblogs.com/chengfu/p/4776191.html
Copyright © 2011-2022 走看看