JS iframe父子页面元素调用方法 | window parent top opener 解释
发布日期:2021-08-22 21:42:18 浏览次数:8 分类:技术文章

本文共 1572 字,大约阅读时间需要 5 分钟。

hot3.png

iframe

父窗口调用子窗口

var hasMore = parent.document.getElementByIdx_x_x_x("hasMore").value;
子窗口调用父窗口
document.frames["ifrmBoxFrame"].me.preLoadBoxGrid();
window.frames["iframe_ID"].document.getElementByIdx_x_x_x("iframe_document_object"-).object_attribute = attribute_value;
window
是对当前窗口自身的引用

如:

window.returnValue = ret;window.close();
top
返回顶层窗口,即浏览器窗口。

如:

top.frames[tabID].location = url;top.document.frames("ifrmBoxFrame").me.executeQueryCond();
parent
返回父窗口

如:

parent.$("Insheet_FrameTable").src = "";parent.frames["Insheet_FrameSheetList"].initInsheetList(false);

opener

opener用于在window.open的页面引用执行该window.open方法的的页面的对象。例如:A页面通过window.open()方法弹出了B页面,在B页面中就可以通过opener来引用A页面,这样就可以通过这个对象来对A页面进行操作。 

如:

var url="editarable.htm?arableID=" + curArableID+"&isDeleteDisabled="+$("Btn_delArable").disabled;
window.open(url, "viewArable", "height=" + h + ",width=" + w + ",left=" + x + ",top=" +y + ",status=no,toolbar=no,menubar=no,location=no");
//第二个页面中 使用openerif(!(window.opener==null || window.opener.closed)){window.opener.me.queryArable();}window.close();

首先来说说 parent.window与top.window的用法 

"window.location.href"、"location.href"是本页面跳转 
"parent.location.href"是上一层页面跳转 
"top.location.href"是最外层的页面跳转 
举例说明: 
如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写 
"window.location.href"、"location.href":D页面跳转 
"parent.location.href":C页面跳转 
"top.location.href":A页面跳转 

parent.frames("frmEletroDocAttachInsert").frames("fraEletroDocAttachView").document.location = "about:blank";top.document.frames('ifrmMainFrame').location.reload();

转载于:https://my.oschina.net/rouchongzi/blog/111859

转载地址:https://blog.csdn.net/weixin_33755847/article/details/92494971 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:nginx安装https支持
下一篇:WEBSHELL权限重启服务器的方法

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月22日 10时00分29秒