日期:2014-05-16  浏览次数:20289 次

js中iframe方法调用
1、iframe子页面调用 父页面js函数
window.praent.a();

2、iframe子父页面调用 子页面js函数
document.getElementById('ifrtest').contentWindow.b();
注:ifrtest是iframe框架的id,b()为子页面js函数。contentWindow属性是指定的frame或者iframe所在的window对象,IE下可以省略。

3. A iframe的页面访问B iframe页面的内容。

    parent.document.getElementById('B iframe的ID').contentWindow.document.getElementById('B iframe页面要访问的元素ID')

4.  A iframe的3级页面访问B iframe页面的内容。

    window.opener.opener.parent.document.getElementById(''B iframe的ID').contentWindow.document.getElementById('B iframe页面要访问的元素ID')