svg - adding use tag

T

tino.cindric

SVG structure

<g id="someID" gmwmsvg:typ="l" gmwmsvg:pri="1000">
<g id="gwmg4" class="D5F2B3w3j6" gmwmsvg:hi="D5F2B3w3j6 R2v1p1o6r3">
<use xlink:href="#D5F2B3w3j6" x="9916" y="2711"
gmwmsvg:act="JavaScript:SetFeatureID('P' + '10380');"></use>
<use xlink:href="#D5F2B3w3j6" x="6995" y="2834"
gmwmsvg:act="JavaScript:SetFeatureID('P' + '10390');"></use>
<use xlink:href="#D5F2B3w3j6" x="4644" y="3775"
gmwmsvg:act="JavaScript:SetFeatureID('P' + '10379');"></use>
<use xlink:href="#D5F2B3w3j6" x="8604" y="6546"
gmwmsvg:act="JavaScript:SetFeatureID('P' + '10375');"></use>
</g>
</g>

Code: (variable X,Y,sAction appropriately set)

ele=doc.getElementById("someID");
nodes=ele.getElementsByTagName("g");
ch=doc.createElement("use");
ch.setAttribute("xlink:href",nodes.item(0).getAttribute("class"));
ch.setAttribute("x",X);
ch.setAttribute("y",Y);
ch.setAttribute("gmwmsvg:act",sAction);
nodes.item(0).appendChild(ch);

nothing happens - any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top