这东西有点和方法重构差不的,只要按照顺序加载就没啥问题,BUT在iframe 这个框框里面就有问题了,相互之前的方法,数据传递就有变化了

<iframe id="gg" name="once" src="once.html" ></iframe>

<iframe id="dd" name="second" src="second.html"></iframe>

<script type="text/javascript">
   function top()
   {
   		alert("top");
    }      //调用子框架gg.html页面中的gg函数,并把“我在top里呼唤gg”传给gg()
   function  top_gg(){
   	 window.frames["once"].gg("我在top里呼唤gg");
    }
</script> 

在once.html写两个方法调用

<script type="text/javascript">
//调用顶层框架中的top函数
function() gg_top{
     top.top();
     })
function gg(t){
    alert(t);
    }
</script> 

在second.html写一个方法调用

<script type="text/javascript">
//在dd.html中调用gg.html中dd_gg()function() dd_gg{
     top.frames["once"].gg("在second中呼唤gg");
     })
</script>

转自:https://blog.csdn.net/qq_43356920/article/details/114533640