关于iframe调用父页面元素操作

在iframe子页面获取父页面元素
代码如下:

 1 //在iframe子页面获取父页面元素
 2 $.('#objld', parent.document);
 3 
 4 //在父页面获取iframe子页面的元素
 5 
 6 $("#objid", document.iframes('iframe').document) 
 7 //
 8 $(document.getElementById('iframeId').contentWindow.document.body).html() $(document.getElementById('iframeId').contentWindow.document.body).html() 
 9 
10 // 在iframe中调用父页面中定义的方法和变量 
11 parent.method
12 parent.value

 

posted @ 2015-12-02 09:35  Super_Eric  阅读(1921)  评论(0编辑  收藏  举报