jQuery 在Iframe父視窗中查詢物件

2021-05-31 23:20:07 字數 833 閱讀 5322

jquery 在iframe父視窗中查詢物件

1.window.parent.document.getelementbyid("idname").innerhtml = "子窗體設定父窗體的id='idname'的html內容";

使用 jquery ,寫法如下:

1.$("#idname", window.parent.document).html("在iframe父視窗中查詢物件,子窗體設定父窗體的id='idname'的html內容");

即指明了是在 window.parent.document 中查詢 id=idname 的元素。

2.parent.$("#idname").html(html); 這種方法要求父文件也要呼叫 jquery.

jquery

如題:

$(selector, window.top.document);//獲得頂級視窗裡面的元素

$(selector, window.opener.document);//獲得開啟該視窗的父視窗裡面的元素

$(selector, window.parent.document);//獲得父視窗裡面的元素

window.location.reload()重新整理當前頁面.

parent.location.reload()重新整理父親物件(用於框架)

opener.location.reload()重新整理父視窗物件(用於單開視窗)

top.location.reload()重新整理最頂端物件(用於多開視窗)

jQuery子iframe呼叫父iframe

子iframe使用jquery訪問父頁面元素 在 選擇元素時加入第二個引數parent.document parent.document val index.html head style background color orange height 200px width 50 float lef...

jquery父視窗與iframe中js方法互相呼叫

1,子iframe內呼叫父類函式方法 window.parent.func 2,子iframe中獲取父介面的元素 xx window.parent.document 這個xx就是父介面中要獲取的元素的id。3,jquery 呼叫子iframe頁面中js的方法 iframefunction 是子頁面的...

父視窗操控iframe

iframe id為iframecover,其中有個classname為m ebookmaker cover的div 需要獲取iframe中的乙個div物件進行操作 參考 發現 window.frames iframecover document根本獲取不到物件,正確的方法應該是 所說,使用cont...