从父页面中查找iframe子页面中对象的方法:
JS:
- document.getElementById(‘iframe‘).contentWindow
- document.getElementById(‘iframe‘).contentWindow.document
- document.getElementById(‘iframe‘).contentWindow.document.body
- document.getElementById(‘iframe‘).contentWindow.document.getElementById(‘icontent‘)
jQuery:
- $(‘#iframe‘).contents()
- $(‘#iframe‘).contents().find(‘body‘)
- $(‘#iframe‘).contents().find(‘body‘).find(‘#icontent‘)
从iframe子页面中查找父页面中对象的方法:
JS:
- [window.]parent
- [window.]parent.document
- [window.]parent.document.body
- [window.]parent.document.getElementById(‘button‘)
jQuery:
- $([window.]parent)
- $([window.]parent.document)
- $([window.]parent.document.body)
- $([window.]parent.document.body).find(‘#button‘)
iframe中 父页面和子页面查找元素的方法
原文:http://www.cnblogs.com/dengshaojun/p/4113068.html