var a = document.querySelector("iframe") 获取到iframe。
var a = document.querySelector("iframe")
var b = a.contentWindow.document 获取到iframe里的document。
var b = a.contentWindow.document
b.getElementById("...") 就能获取到iframe里元素的id了。
b.getElementById("...")
chrome控制台console演示: