1. 程式人生 > >iframe中獲取父元素的window物件

iframe中獲取父元素的window物件

1. 父窗體獲取iframe的window物件

     var mainFrame = document.getElementById("myFrame");

var subDocument = mainFrame.contentDocument || mainFrame.contentWindow.document;

2. iframe中獲取父窗體window物件

 window.parent
3. 父窗體中獲取iframe中的元素

$('iframe的id').contents()