本文實例講述了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”的列表(局部刷新):
希望本文所述對大家的jQuery程序設計有所幫助。
新聞熱點
疑難解答