子页面调用父页面的js方法

来源:互联网 发布:淘宝推广培训班 编辑:程序博客网 时间:2024/04/29 09:36

1)iframe调用父页面的js

window.parent.freshList();

2)iframe调用多层的父页面的js

以自定义查询新增查询条件的页面newCustom.jsp为例:

var frames=window.parent.parent.window.document.getElementById("operateIframe").

      contentWindow.document.getElementById("descriptIframe");
frames.contentWindow.customSearch(queryId);


window.parent 为包含该Ifame(newCustom.jsp)的页面mainCustom.jsp

window.parent.parent 为弹出查询条件设定页面(mainCustom.jsp)的父页面mainPage.jsp.

window.parent.parent.window.document.getElementById("operateIframe")为获得mainPage.jsp的iframe的著录功能的主页面frame.jsp

window.parent.parent.window.document.getElementById("operateIframe").contentWindow.document.getElementById("descriptIframe")为frame.jsp页面左侧菜单树旁边的右侧显示查询结果的表格页面archivesPage.jsp。

customSearch(queryId)为这个页面拥有的js,archivesPage.js中的方法。





0 0
原创粉丝点击