Why would you need the xlink-prefix in this case? I would suggest this
instead:
a_elem.setAttributeNS("http://www.w3.org/1999/xlink","href","http://www.kevlindev.com");
You already say (with the first parameter) that the namespace is XLink, so
there is no need to prefix the attribute with "xlink:".
On another note, evt.getTarget().getOwnerDocument() should really be
evt.target.ownerDocument. At least if you want it to work in other viewers
than ASV.
Regards
/Erik
On Thu, 22 Jun 2006 18:05:36 +0200, pavoturkey <[EMAIL PROTECTED]>
wrote:
> 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>
>>
>
>
>
>
>
>
>
> -----
> 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
>
>
>
>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
------------------------ 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/