<iframe id="ifr" src="test.html"></iframe> // 父级页面的iframe
let iframe = document.getElementById("ifr");
let testchild = iframe.contentWindow.document.getElementById("test"); // 重点:contentWindow
以上代码即可获取iframe标签引入的页面中的元素,获取到之后想要怎么操作就怎么操作了。