使用普通JavaScript移动SVG
我有一个tspan-使用普通JavaScript移动SVG,javascript,svg,Javascript,Svg,我有一个tspan- <tspan>Some text</tspan> 如何在JavaScript中将x和y设置为2和4?所以它应该相当于 <tspan x="2" y="4">Some text</tspan> 一些文本 您应该使用: <tspan x="2" y="4">Some text</tspan> yourElement.setAttribute("x","2"); yourElement.setAtt
<tspan>Some text</tspan>
如何在JavaScript中将x和y设置为2和4?所以它应该相当于
<tspan x="2" y="4">Some text</tspan>
一些文本
您应该使用:
<tspan x="2" y="4">Some text</tspan>
yourElement.setAttribute("x","2");
yourElement.setAttribute("y","4");