zoukankan      html  css  js  c++  java
  • iFrame框架高度自适应

    由于不想使用滚动条,又不想固定框架的高度,想使他根据内容的多少而自动调整高度。
    1. 主页面的框架代码:

    <iframe id="ifr" src="test.html" width="660"  frameborder="0" scrolling="no" name="aa" id="aa"></iframe> 

    2. 所嵌套子页面test.html在head添加脚本:

    代码
    <script language="JavaScript" type="text/javascript">
            
    function f_frameStyleResize(targObj) {
                
    var targWin = targObj.parent.document.all[targObj.name];
                
    if (targWin != null) {
                    
    var HeightValue = targObj.document.body.scrollHeight
                    
    if (HeightValue < 500) { HeightValue = 500 }
                    targWin.style.pixelHeight 
    = HeightValue;
                }
            }
            
    function f_iframeResize() {
                bLoadComplete 
    = true; f_frameStyleResize(self);
            }
            
    var bLoadComplete = false;
            window.onload 
    = f_iframeResize;
        
    </script>
  • 相关阅读:
    数组与指针
    壁纸
    2019/1/11
    指针A
    数组B
    一起来抓老鼠啊!快乐呀!
    打印沙漏
    I think I need a boat house
    币值转换
    《C语言程序设计》编程总结汇总
  • 原文地址:https://www.cnblogs.com/janes/p/1832389.html
Copyright © 2011-2022 走看看