SVG 1.1 Javascript参考 [英] SVG 1.1 Javascript Reference

查看:109
本文介绍了SVG 1.1 Javascript参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到SVG中没有 document.write

I have noticed that there is no document.write in SVG.

目前我正在寻找类似的功能。

Currently I'm looking for a similar function .

Unfortunatley我找不到列出的网站与SVG DOM相关或支持的所有功能(例如与文档对象相关)。

Unfortunatley I couldn't find a website that lists all the functions related or supported by the SVG DOM (for eg. related to the document object).

你知道任何在线资源,我可以找到SVG文档,特别是与scriptin相关的东西(类似于JAVADOC)。

Do you know any online resources where I can find SVG documentation, especially related to scriptin (something similar to a JAVADOC).

推荐答案

您不能使用document.write,因为SVG是XML,而不是标签汤。

You can't use document.write since SVG is XML, not tag soup.

如果你想要导入完整的XML节点,您必须手动执行或使用标准DOM importNode方法。

If you want to import a full XML node, you either have to do it by hand or use the standard DOM importNode method.

例如,如果从AJAX检索XML节点,首先使用responseXML将响应解析为XML,然后使用document.importNode方法导入它,以便您可以在SVG文档中使用它,并使用标准DOM方法(appendChild或insertBefore)插入。

For example, if you retrieve an XML node from AJAX, first use the responseXML to parse the response as XML, then import it with the document.importNode method so that you can use it whithin your SVG document and insert it with a standard DOM method (appendChild or insertBefore).

这篇关于SVG 1.1 Javascript参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆