父頁面調用子頁面
父頁面調用子頁面方法:
$("#mainfrm")[0].contentWindow.test(); //mainfrm 父頁面ID ; test() 子頁面中的方法
父頁面獲取子頁面元素對象:
$("#iframe-task").contents().find("#path"); //path 子頁面元素id
子頁面調用父頁面
子頁面調用父頁面方法:
window.parent.父頁面方法();
子頁面使用父頁面的變量:
window.parent.變量名
子頁面獲取父頁面的元素對象:
$(window.parent.document).contents().find("#leftMenu"); //#leftMenu爲父頁面的元素ID