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==================

  • 相关阅读:
    openwrt编译出错处理记录
    转:小白编译openwrt固件教程
    转:openwrt中luci学习笔记
    (转)内存和外设的统一编址及独立编址
    (转)无法打开C盘,提示"本次操作由于这台计算机的限制被取消,请与你的管理员联系”
    (转)c# 解析JSON的几种办法
    计算机中断(转贴,很经典的解释)
    转:用WCAT进行IIS压力测试
    转:windows命令行下如何查看磁盘空间大小
    转:如何在32位程序中突破地址空间4G的限制
  • 原文地址:https://www.cnblogs.com/konglxblog/p/10011994.html
Copyright © 2011-2022 走看看