How to Append a Child?

shwathi
06-15-2004, 11:51 PM
Hello,

I want to append this child to my document. How do I do this?

<a xlink:href="a.html" >
<text x="100" y="100" > My Text </text>
</a>

Regards,
Shwathi. 8)

thiru
06-16-2004, 04:37 AM
Hi Shwathi,

You can use setAttributeNS. This is what I found from svg-developers yahoo groups
given by Julians:

<svg width="200" height="200" onload="addLink()">
<script language="JavaScript"><![CDATA[
function addLink(){
A=svgDocument.createElement('a');

A.setAttributeNS('http://www.w3.org/1999/xlink','xlink:href','a.html');
TXT=svgDocument.createElement('text');
TXT.setAttribute('x',100);
TXT.setAttribute('y',100);
TXT.appendChild(svgDocument.createTextNode('My Text'));
A.appendChild(TXT);
svgDocument.documentElement.appendChild(A);
}
]]></script>
</svg>

Regards,
Thiru. 8) 8)

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum