.js在iframe子页面操作父页面元素代码:
?
1window.parent.document.getElementByIdx_x(“父页面元素id”);
2.js在父页面获取iframe子页面元素代码如下:
?
1window.frames[“iframe_ID”].document.getElementByIdx_x(“子页面元素id”);
- jquery在iframe子页面获取父页面元素代码如下:
?
1$(“#objid”,parent.document)
- jquery在父页面获取iframe子页面的元素
?
1$(“#objid”,document.frames(‘iframename’).document)
5.在iframe中调用父页面中定义的方法和变量:
?
1
2window.parent.window.parentMethod();
window.parent.window.parentValue;
6.在父页面操作iframe子页面的方法和变量
?
1
2window.frames[“iframe_ID”].window.childMethod();
window.frames[“iframe_ID”].window.childValue;