html之iframe

*、iframe之获取父页面元素

第一种:$(selector,window.parent.document).......
该方法比普通选择器多了一个参数即父页面对象!
第二种:$(window.parent.document).find().....
该方法是首先获取父页面的document对象!

 

2. jquery在父页面获取iframe子页面的元素

$(selector,document.frames('iframe_id').document)....

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

window.parent.document.getElementById/....("selector");
 

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

window.frames["iframe_ID"].document.getElementById/....("selector");

5.iframe内调用父页面函数:

window.parent.func();
 

5.父页面调用iframe内函数-正确性待定:

document.frames('iframe_id').document.func();

猜你喜欢

转载自lbovinl.iteye.com/blog/2350762