Try changing this line:
a_elem.setAttributeNS("http://www.w3.org/2000/xlink","xlink:href","http://www.kevlindev.com");
TO,
a_elem.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","http://www.kevlindev.com");
Notice the different namespace reference link.
That should fix it.
--- In [email protected], "raoulkam" <[EMAIL PROTECTED]> wrote:
>
> I'm trying to dynamiccaly create a link to an svg element. Any ideas
> why this doesn't work?
> <svg>
> <script onload="init(evt)">
> function init(evt) {
> var SVGDoc = evt.getTarget().getOwnerDocument();
> var text_elem = SVGDoc.getElementById("text_elem");
> var a_elem = SVGDoc.createElement("a");
> var text_node = SVGDoc.createTextNode("This is a link");
> a_elem.setAttributeNS
> ("http://www.w3.org/2000/xlink","xlink:href","http://www.kevlindev.co
> m");
> a_elem.setAttribute("id", "link");
> a_elem.setAttribute("target", "_blank");
>
>
> a_elem.appendChild(text_node);
> text_elem.appendChild(a_elem);
> }
> </script>
> <text id="text_elem" x="0" y="1em"> </text>
> </svg>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Something is new at Yahoo! Groups. Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~->
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/