zoukankan      html  css  js  c++  java
  • 自动获取iFrame的高度,父iframe取得子iframe的form

    function iFrameHeight(ifm) {

    //var ifm = document.getElementById('iframeBox4');
    //var subWeb = document.frames ? document.frames["iframeBox4"].document : ifm.contentDocument; // IE和其他浏览器兼容选择
    //if (ifm != null && subWeb != null) {
    //ifm.height = subWeb.body.offsetHeight; //offsetHeight 页面高度
    //}
    if (ifm) {
    var iframeWin = ifm.contentWindow || ifm.contentDocument.parentWindow;
    if (iframeWin.document.body) {
    ifm.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
    }
    }
    }

    <div>
    <iframe name="iframe" id="iframeBox1" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>

    <iframe name="iframe" id="iframeBox2" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>
    <iframe name="iframe" id="iframeBox3" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>

    <iframe name="iframe" id="iframeBox4" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>

    <iframe name="iframe" id="iframeBox5" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>

    <iframe name="iframe" id="iframeBox6" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>

    <iframe name="iframe" id="iframeBox7" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>

    <iframe name="iframe" id="iframeBox8" frameborder="0" width="100%" height="100%" scrolling="auto "
    src="" style="display: none"
    style="overflow-x: hidden; overflow: auto;" onload="iFrameHeight(this);"></iframe>
    </div>

    =======父iframe取得子iframe的form==========start============

    //先清空之前的缓存,在保存最新的内容审核干部人事档案

    var iframeBox4_iframe = document.getElementById('iframeBox4').contentWindow;
    var iframeBox4_div =iframeBox4_iframe.document.getElementById('zzzkcGbthSaveForm');
    var iframeBox41_div =iframeBox4_iframe.document.getElementById('zzzkcSaveForm');

    // 缓存数据
    localStorage.zzzkcGbthSaveForm=decodeURIComponent($(iframeBox4_div).serialize(),true);
    localStorage.zzzkcSaveForm=decodeURIComponent($(iframeBox41_div).serialize(),true);

    =======父iframe取得子iframe的form====end==================

  • 相关阅读:
    3js深入
    01课js初接触;
    弥合对象/关系之间的鸿沟(一)
    Spiral Matrix——螺旋矩阵
    原来···是不是高手,看try cathch都能看出来···
    Web视频分享处理类库的设计
    每个开发人员现在应该下载的十种必备工具
    使用C#得到局域网内所有主机名,IP地址,MAC地址,使用C# 实现查看所有系统事件
    IIS 错误 :“NETWORK SERVICE does not have write access” 解决办法
    配置Url Remap时发生Parser Error的解决办法
  • 原文地址:https://www.cnblogs.com/konglxblog/p/10011994.html
Copyright © 2011-2022 走看看