Home  >  Article  >  Web Front-end  >  jQuery子窗体取得父窗体元素的方法_jquery

jQuery子窗体取得父窗体元素的方法_jquery

WBOY
WBOYOriginal
2016-05-16 15:59:531059browse

本文实例讲述了jQuery子窗体取得父窗体元素的方法。分享给大家供大家参考。具体如下:

$("#父窗口元素ID",window.parent.document);

对应javascript版本为

window.parent.document.getElementById("父窗口元素ID");

取父窗口的元素方法:

$(selector, window.parent.document);

取父窗口的父窗口的元素就可以用:

$(selector, window.parent.parent.document);

类似的,取其它窗口的方法大同小异
获取iframe父窗体元素:

$(selector, window.parent.document);

获取通过windows.open()打开的父窗体:

$(selector, window.opener.document);

获取通过 showModelDialog()打开的父窗体:

$(selector, window.dialogArguments.document);

用于刷新父窗口整个页面:

window.parent.location.reload();

window插件关闭窗口,类似于window.close():

parent.subWindow_add.Close();

刷新父页面中的id为“4thEditTable”的列表(局部刷新):

复制代码 代码如下:
parent.$("#4thEditTable").load(window.parent.location.href+" #4thEditTable");

希望本文所述对大家的jQuery程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn