js子级窗口相互调用父级的方法

jump.html 是父级页面

方法aaa() 是没有任何地方调用的。

myframe.html 是父级页面打开的一个Iframe,即子级窗口。

当如果你想子级窗口处理完逻辑,告知父级情况的时候,就可以用到以下的方法。

window.parent.父级方法名();

运行看效果~~

这样就算完成了~~~

父级调用子级的方法:

document.getElementById("子级ID").contentWindow.子级的方法名();

例:document.getElementById("myframe").contentWindow.getRequest();

原文地址:https://www.cnblogs.com/jincieryi/p/9630046.html