JQuery子窗體取得父窗體的元素


$("#父窗口元素ID",window.parent.document);
對(duì)應(yīng)JavaScript版本為window.parent.document.getElementByIdx_x("父窗口元素ID");
 
取父窗口的元素方法:$(selector, window.parent.document);
取父窗口的父窗口的元素就可以用:$(selector, window.parent.parent.document);

類似的,取其它窗口的方法大同小異
$(selector, window.parent.document); // 獲取iframe父窗體元素
$(selector, window.opener.document); // 獲取通過(guò)windows.open()打開的父窗體
$(selector, window.dialogArguments.document); // 獲取通過(guò) showModelDialog()打開的父窗體


原文鏈接:JQuery子窗體取得父窗體的元素