zoukankan      html  css  js  c++  java
  • 自动适应Iframe

    function iframeAutoFit()
                {
                  try
                  {
                    if(window!=parent)
                    {
                      var a = parent.document.getElementsByTagName("IFRAME");
                      for(var i=0; i<a.length; i++) //www.deepteach.com
                      {
                        if(a[i].contentWindow==window)
                        {
                          var h = document.body.scrollHeight;
                          if(document.all) {h += 4;}
                          if(window.opera) {h += 1;}
                          a[i].style.height = h;
                        }
                      }
                    }
                  }
                  catch (ex)
                  {
                    alert("脚本无法跨域操作!");
                  }
                }
                //在子页面中增加
                if(document.attachEvent)
                  window.attachEvent("onload",  iframeAutoFit);
                else
                  window.addEventListener('load',  iframeAutoFit,  false);
  • 相关阅读:
    c# winform DataGridView导出数据到Excel中,可以导出当前页和全部数据
    水晶报表动态加载图片(签名)
    第1章 开启Threejs之旅(一)
    Python中@contextmanager的用法
    Systemd
    Python中with的用法
    systemctl的配置和使用
    /*CS5460_Note_1*/
    Just try the code
    MCP2515无BUG版本驱动(C文件)
  • 原文地址:https://www.cnblogs.com/yinchengliang/p/2593093.html
Copyright © 2011-2022 走看看