如题,父页面的JS如何拿到iframe里的dom,并且进行操作? 原生JS,不用JQ之类的 页面代码:
<body>在chrome的console里:<iframe id="container" name="container" src="frames/index.html"></iframe>
</body>
document.getElementById("container")Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match. Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match. Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
<iframe id="container" name="container" src="frames/index.html">...</iframe>
document.getElementById("container").contentWindow.documentBlocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
undefined
window.frames["container"].documentBlocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
undefined