父頁面有個ID為mainfrm、name為Iframe1的iframe,iframe連接b.html,該頁面有個函數test
在父頁面調用b.html的test方法為:
$("#mainfrm")[0].contentWindow.test();
或者
this.frames["Iframe1"].doQuery();
在當前彈出的子頁面中打開另一個打開頁面中的函數,例如在彈出的edit.html頁面中調用dataList.html頁面中的函數test
parent.document.frames["Iframe1"][0].test();
////////////////////////////////////////////////////////////////////////////////////
第一、在iframe中查找父頁面元素的方法:
$('#id', window.parent.document)
第二、在父頁面中獲取iframe中的元素方法:
$(this).contents().find("#suggestBox")
第三、在iframe中調用父頁面中定義的方法和變量:
parent.method
parent.value
iframe里用jquery獲取父頁面body
iframe.html

<html> <script src='jquerymin.js'> </script> <body id='1'> <div>it is a iframe</div> </body> <script> $(document).ready( function() { var c = $(window.parent.document.body) //麻煩的方法: var c = $($(window).eq(0)[0].parent.document).find('body'); ,忘了可以用前面的方法了 alert(c.html()); } ); </script> </html>