我能够通过set attr改变文本的x,y坐标...但是通过tref的文本内容似乎xlink:href不起作用;是因为它在jsp帧中调用
<?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">
<html>
<head>
<script>
function ichange() {
var vx100=420; var vy100=100;
var res=vx100.valueOf(); var newv="budhan";
document.getElementById("tts").setAttribute("x", res);//works
document.getElementById("tts").setAttribute("y", vy100);//works
tts.textContent="Mercury";//does not work
alert(tts.textContent);
}
</script>
</head>
<BODY>
<form>
<input id="button1" type="button" value="Change Dimensions" onclick="ichange();"/>
</form>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org
/1999/xlink" version="1.1" width="1100" height="800" >
<defs>
<text id="theText">Mercury</text>
</defs>
<text id="tts" x="50" y="80" font-size="17" fill="red">Sun </text>
<text id="tts" x="100" y="130" font-size="23" fill="black"><tref
xlink:href="#theText"/> </text>
<%--tref is not working .. basically need to replace string Sun with
String mercury--%>
</svg>
</body>
</html>