gpt4 book ai didi

javascript - 获取驻留在 iframe 中的 SVG 的 DOM

转载 作者:搜寻专家 更新时间:2023-11-01 04:20:15 25 4
gpt4 key购买 nike

我有一个嵌入了 SVG 的 iframe。 SVG 是由 GraphViz 生成的,因此我无法对其进行太多更改。我需要的是访问父页面中的 SVG DOM。

iframe的来源是

<iframe id='graph' src='gen-graph.php' /> 

关于如何访问 SVG 的不同节点(文本、多边形)等的任何提示?

最佳答案

这是 an example从父文档进入外部 svg 文档。

您正在寻找的是 iframe 的 contentDocument,可以通过 yourIFrameElement.contentDocument 访问它。然后像使用普通的 document 对象一样使用 contentDocument。

关于javascript - 获取驻留在 iframe 中的 SVG 的 DOM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6419634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com