假设您有以下HTML:
<div>
<iframe src="..">
<!-- The following would be the content of the iframe -->
<html><head></head><body>
<span>I'm the node</span>
</body></html>
</iframe>
</div>
您有一个变量iframeNode
,其中包含该iframe中的<span>
元素。您的脚本上下文是父窗口。
您如何获得父iframe元素:
<iframe src="..."></iframe>
通过这个节点?
理论上:
var iframe = iframeNode.myParentIframeElementInTheParentScope;
答案 0 :(得分:1)
如果DELETE
(iframe
中span
的唯一引用是iframe
,那么
iframeNode
将引用父窗口中的iframe元素。