Loading ...
Sorry, an error occurred while loading the content.

Re: How to get element applied to element

Expand Messages
  • iwelina79
    Thanks, you are right the a-element is the parent node. Ivelina
    Message 1 of 3 , Apr 13, 2004
    • 0 Attachment
      Thanks,

      you are right the a-element is the parent node.

      Ivelina
      --- In svg-developers@yahoogroups.com, "zuccaralloo" <me@z...> wrote:
      > Hi,
      >
      > I don't know whether I got you right:
      >
      > Your function will create links like this e.g.
      >
      > <a xlink:href="http://..." target="new">
      > <text id="1">labelText</text>
      > </a>
      >
      > The a-element is the parent node of the text-element, so
      > svgdocument.getElementById("text1").parentNode should work.
      >
      > Heiko
      >
      > --- In svg-developers@yahoogroups.com, "iwelina79" <iwelina@m...>
      > wrote:
      > > Here is my code which creates <text> and <a> elements:
      > >
      > > data = svgdocument.createTextNode(sLabel );
      > > newtext = svgdocument.createElement("text");
      > > ...
      > > newtext.appendChild(data);
      > >
      > > a_elem = svgdocument.createElement("a");
      > > a_elem.setAttributeNS
      > > ("http://www.w3.org/1999/xlink","xlink:href","http://"+ sURL)
      > >
      > > a_elem.setAttribute("target","new");
      > > a_elem.appendChild(newtext);
      > > svgdocument.getElementById("nodes").appendChild(a_elem);
      > >
      > > I got text object but I don't know how to get the <a> one.I tried
      > > with :
      > > svgdocument.getElementById("text1").getElementsByTagName("a").item
      > (0)
      > >
      > > but it doesn't work.
      > > Do you know how to get the <a> element applied to concrete <text>
      > > element?
      > >
      > > Thanks
    Your message has been successfully submitted and would be delivered to recipients shortly.