• 自动获取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==================

  • 相关阅读:
    前后端分离
    Do a “git export” (like “svn export”)?(转)
    最有价值的信息就是这样的信息:大象是绳子,大象是扇子,大象是柱子…… 这样的信息往往是扭曲的,残缺的,隐晦不明的(转)
    说服他。说不服再按着他的去办(转)
    动手学习TCP:数据传输(转)
    应用程序框架实战十三:DDD分层架构之我见(转)
    UVA11627-Slalom(二分法)
    数据库系统原理及其应用总结---ShinePans
    cocos2d-x 3.0游戏实例学习笔记 《跑酷》第四步--地图循环&amp;主角加入动作
    Android学习四、Android中的Adapter
  • 原文地址:https://www.cnblogs.com/konglxblog/p/10011994.html
Copyright © 2020-2023  润新知