1. iframe中不存在name和id的方法
var iframe = document.getElementsByTagName('iframe')[0].contentWindow
iframe.document.querySelector("#元素")
2. iframe中存在name或者id
var iframe = document.getElementById('iframeId')
iframe.querySelector("#元素")
3. 子窗口获取父窗口的元素
var iframe = window.parent.document.getElementById('iframeId')
iframe.querySelector("#元素")
7129

被折叠的 条评论
为什么被折叠?



