0

我有一个适用于 SVG 和 JS 的项目。现在SVG负责调用JS。在 SVG 代码的中间有这样一条指令:

植物30263.svg

<?xml version="1.0" encoding="UTF-8"?>
....
<script type="text/javascript" xlink:href="tatu1/svgEditarVisualizacao.js"     xlink:actuate="onLoad" xlink:show="other" xlink:type="simple" />
.....

但是,有时需要将目录从一台服务器更改为另一台服务器。(tatu1 -> tatu2) 所以,我想知道是否有办法让JS在嵌入SVG的页面中调用SVG,外部调用。

vis_rota.jsp

....
<embed  src="<%=planta%>" id="plantaSVG" type="image/svg+xml" name="plantaSVG" />
....
4

2 回答 2

1

The xlink:actuate, xlink:show and xlink:type attributes on the script element are not necessary, you can safely remove them.

It's better to use <object> rather than <embed> because then you can then provide fallback content if a browser lacks the ability to display svg, or if it has been disabled for any reason. For more information see the SVG Primer.

If you want to call functions from the svg to the document that referenced it, then see scripting between svg and html for some examples.

于 2011-03-14T15:04:21.913 回答
0

不确定你想要什么和一个插件,但在iscriptdesign你可以看到一些 javascript 操作来查看不同的 svg 图像。在线适配图片,使用html 5的file api上传。

于 2011-03-14T15:00:11.453 回答