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

Element Update

Expand Messages
  • Suddhasheel Ghosh
    Hello Colleagues, I want to create a new element in SVG by the following code in JavaScript... newElement = svgDocument.createElement( polygon );
    Message 1 of 5 , Jul 31, 2003
    • 0 Attachment
      Hello Colleagues,

      I want to create a new element in SVG by the following code in
      JavaScript...

      newElement = svgDocument.createElement("polygon");
      newElement.setAttribute("id","TestElt");
      newElement.setAttribute("fill","red");
      newElement.setAttribute("stroke","black");
      newElement.setAttribute("points","30,34 45,56 78,34 78,45");

      But this element is not showing up immediately on the SVG... What is
      the problem ?

      What can I do to update the screen ?

      Regards,

      Suddhasheel Ghosh
    • Francis Hemsher
      The next line of code would be... mySVG.appendChild(newElement) mySVG, or similar id for the SVG source. Or if you are adding it to a group...
      Message 2 of 5 , Jul 31, 2003
      • 0 Attachment
        The next line of code would be...
        mySVG.appendChild(newElement)

        mySVG, or similar id for the SVG source.

        Or if you are adding it to a group...
        MyGroup.appendChild(newElement)

        where myGroup is the id="myGroup" for a group.

        Francis



        --- In svg-developers@yahoogroups.com, "Suddhasheel Ghosh"
        <suddhasheel@y...> wrote:
        > Hello Colleagues,
        >
        > I want to create a new element in SVG by the following code in
        > JavaScript...
        >
        > newElement = svgDocument.createElement("polygon");
        > newElement.setAttribute("id","TestElt");
        > newElement.setAttribute("fill","red");
        > newElement.setAttribute("stroke","black");
        > newElement.setAttribute("points","30,34 45,56 78,34 78,45");
        >
        > But this element is not showing up immediately on the SVG... What
        is
        > the problem ?
        >
        > What can I do to update the screen ?
        >
        > Regards,
        >
        > Suddhasheel Ghosh
      • Jim Ley
        Francis Hemsher wrote in message news:bgbasm+op0u@eGroups.com... ... myGroup=SVGDoc.getElementById( myGroup ) Where SVGDoc is a
        Message 3 of 5 , Jul 31, 2003
        • 0 Attachment
          "Francis Hemsher" <francishemsher@...> wrote in message
          news:bgbasm+op0u@......
          > Or if you are adding it to a group...
          > MyGroup.appendChild(newElement)
          >
          > where myGroup is the id="myGroup" for a group.

          myGroup=SVGDoc.getElementById('myGroup')

          Where SVGDoc is a pointer to the document, simply going myGroup will not
          work reliably, in fact I've never seen it work in ASV.

          Jim.
        • Suddhasheel Ghosh
          Can i use the following for appendChild ? svgDocument.appendChild(newElement); Further, is it possible to append a whole array at once or I will have to get it
          Message 4 of 5 , Aug 1, 2003
          • 0 Attachment
            Can i use the following for appendChild ?

            svgDocument.appendChild(newElement);

            Further, is it possible to append a whole array at once or I will
            have to get it done one by one ?

            Thanks for reply..

            Suddhasheel Ghosh

            --- In svg-developers@yahoogroups.com, "Francis Hemsher"
            <francishemsher@c...> wrote:
            >
            > The next line of code would be...
            > mySVG.appendChild(newElement)
            >
            > mySVG, or similar id for the SVG source.
            >
            > Or if you are adding it to a group...
            > MyGroup.appendChild(newElement)
            >
            > where myGroup is the id="myGroup" for a group.
            >
            > Francis
            >
            >
            >
            > --- In svg-developers@yahoogroups.com, "Suddhasheel Ghosh"
            > <suddhasheel@y...> wrote:
            > > Hello Colleagues,
            > >
            > > I want to create a new element in SVG by the following code in
            > > JavaScript...
            > >
            > > newElement = svgDocument.createElement("polygon");
            > > newElement.setAttribute("id","TestElt");
            > > newElement.setAttribute("fill","red");
            > > newElement.setAttribute("stroke","black");
            > > newElement.setAttribute("points","30,34 45,56 78,34 78,45");
            > >
            > > But this element is not showing up immediately on the SVG...
            What
            > is
            > > the problem ?
            > >
            > > What can I do to update the screen ?
            > >
            > > Regards,
            > >
            > > Suddhasheel Ghosh
          • Chris Peto
            Hi, It needs to be root.appendChild() or if you have a group then group.appendChild(). Yes, you have to add them one by one. Mit freundlichen
            Message 5 of 5 , Aug 1, 2003
            • 0 Attachment
              Hi,

              It needs to be root.appendChild() or if you have a group<g> then
              group.appendChild().

              Yes, you have to add them one by one.

              Mit freundlichen Grüßen/Regards
              Chris Peto
              Freelance System Development
              ------------------------------------
              Resource Solutions
              Höhenweg 34
              63303 Dreieich - Götzenhain
              Germany
              Mobile: +49 (0) 173 308 7843
              Tel:+49(0) 6103 80 21 98
              Web: http://www.resource-solutions.de
              mailto:CPeto@...
              ------------------------------------
              Member of: SPARK - SVG Programmers' Application Resource Kit
              http://www.schemasoft.org/






              -----Original Message-----
              From: Suddhasheel Ghosh [mailto:suddhasheel@...]
              Sent: Freitag, 1. August 2003 10:02
              To: svg-developers@yahoogroups.com
              Subject: [svg-developers] Re: Element Update


              Can i use the following for appendChild ?

              svgDocument.appendChild(newElement);

              Further, is it possible to append a whole array at once or I will
              have to get it done one by one ?

              Thanks for reply..

              Suddhasheel Ghosh

              --- In svg-developers@yahoogroups.com, "Francis Hemsher"
              <francishemsher@c...> wrote:
              >
              > The next line of code would be...
              > mySVG.appendChild(newElement)
              >
              > mySVG, or similar id for the SVG source.
              >
              > Or if you are adding it to a group...
              > MyGroup.appendChild(newElement)
              >
              > where myGroup is the id="myGroup" for a group.
              >
              > Francis
              >
              >
              >
              > --- In svg-developers@yahoogroups.com, "Suddhasheel Ghosh"
              > <suddhasheel@y...> wrote:
              > > Hello Colleagues,
              > >
              > > I want to create a new element in SVG by the following code in
              > > JavaScript...
              > >
              > > newElement = svgDocument.createElement("polygon");
              > > newElement.setAttribute("id","TestElt");
              > > newElement.setAttribute("fill","red");
              > > newElement.setAttribute("stroke","black");
              > > newElement.setAttribute("points","30,34 45,56 78,34 78,45");
              > >
              > > But this element is not showing up immediately on the SVG...
              What
              > is
              > > the problem ?
              > >
              > > What can I do to update the screen ?
              > >
              > > Regards,
              > >
              > > Suddhasheel Ghosh


              Yahoo! Groups Sponsor
              ADVERTISEMENT




              -----
              To unsubscribe send a message to:
              svg-developers-unsubscribe@yahoogroups.com
              -or-
              visit http://groups.yahoo.com/group/svg-developers and click "edit my
              membership"
              ----

              Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.