zoukankan      html  css  js  c++  java
  • iframe子页面内刷新父页面中另一个iframe子页面

    框架页面如下:

    <div id="aa" style="float: left; height: 500px; border-right-style: solid; border-right-color: #CCCCFF; border-right- 2px;">   
            <IFRAME id="tree" name="tree"  
                src="/ScienProjectWeb/commonjsp/selectdepartment.jsp?classid=${Hthm_DefaultClassid}&user=1"  
                frameBorder=0 width="248px" scrolling="auto" height="95%" allowtransparency>   
            </IFRAME>   
        </div>   
        <div style="float: left;">   
            <div id="ttr" style="scrolling: auto;height: 300px;border:1px solid blue;">   
                <IFRAME id="opertop" name="opertop"  
                    src="/ScienProjectWeb/commonjsp/userlist.jsp"  
                    frameBorder="0" width="100%" scrolling="auto" height="100%" allowtransparency>   
                </IFRAME>   
            </div>   
            <div style="height: 200px;border:1px solid blue;">   
                <IFRAME id="operbottom" name="operbottom"  
                    src="#" frameBorder="0"  
                    width="100%" scrolling="auto" allowtransparency>   
                </IFRAME>   
            </div>   
        </div>  
    

      

    在tree页面中想要刷新opertop页面内容,两种方法:

    第一种:window.parent.document.getElementById("opertop").src=url;(有无window.都可),注意,此处不能用window.parent.frames["opertop"].src=url;

    第二种(推荐,将三个页面互相传递信息的方法统一放在父页面中,集中管理)

    在父页面中定义方法

    function refreshframe(url)   
    {   
      //window.frames['opertop'].src=url;这种写法也不对,只能通过document.getElementById方式   
      $('#opertop').attr("src",url);   
    }  
    

    子页面中调用

    parent.refreshframe(url);  
    

      

  • 相关阅读:
    如何手动封装 $ on off emit?
    Vue 实例身上的一些方法(二)
    Vue 实例身上的一些方法(一)
    Vue属性过滤
    Vue属性监听
    Vue实现简单的商品增减功能
    Vue 计算属性
    使用Vue实现一个简单地自定义拖拽功能
    数组的深拷贝与浅拷贝
    如何让html引用公共布局(多个html文件公用一个header.html和footer.html)
  • 原文地址:https://www.cnblogs.com/lengv10/p/3796985.html
Copyright © 2011-2022 走看看