作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个嵌入了 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/
我是一名优秀的程序员,十分优秀!