zoukankan      html  css  js  c++  java
  • Iframe 高度自适应的问题

    外层div ,div 内包含iframe  ;如何当内部iframe 高度变化时,外层的div 高度跟着自适应呢?

    1:

    <div>
    <IFRAME height="100%" width="100%" frameBorder=0
    id=inspfrmchild name= inspfrmchild scrolling="no"
    onload="javascript:dyniframesize('inspfrmchild');"
    src="${path }/inspect-Inspinfo-inspinfoDetial.do" allowTransparency="true">
    </IFRAME>
    </div>

    2:

    function dyniframesize(down) {
    var pTar = null;
    if (document.getElementById){
    pTar = document.getElementById(down);
    }
    else{
    eval('pTar = ' + down + ';');
    }
    if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
    //ns6 syntax
    pTar.height = pTar.contentDocument.body.offsetHeight + 29;
    pTar.width = pTar.contentDocument.body.scrollWidth;
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
    //ie5+ syntax
    pTar.height = pTar.Document.body.scrollHeight;
    pTar.width = pTar.Document.body.scrollWidth;
    }
    }
    }

    3:当内部iframe 动态变化时,可内部调用JS函数,将外部的div 高度重新生成

  • 相关阅读:
    学生管理系统(2:添加主界面窗口)
    Qfile
    QButtonGroup
    comboBox
    QLineEdit
    QMessageBox
    实现简单的计算器(控制器代码)
    实现简单的计算器(计算功能模块实现)
    网络编程基础【HTML编程】
    网络编程基础【正则表达式】
  • 原文地址:https://www.cnblogs.com/leonkobe/p/4041095.html
Copyright © 2011-2022 走看看