动态修改svg文件的内容
分享知识http://www.fedrobots.com/?search=200978我来纠错//SVG文件
<?xml version="1.0"standalone="no"?>
<!DOCTYPE svg PUBLIC"-//W3C//DTD SVG 1.1//EN""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<text id="txt"x="65"y="70"style="font-size:12px;"fill="red">Hello</text>
</svg>
//text标签必须有初值 方法一:
txt = svgDocument.getElementById("txt");
txt.firstChild.nodeValue="Hello World !";
//方法二:
var txt=svgDocument.getElementById("txt");
var newText = svgDocument.createTextNode("Hello World !");
txt.replaceChild(newText,txt.firstChild);