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

Drawing shapes in IE using javascript

Expand Messages
  • sean_imler
    I ve been trying to draw a simple shape in an html page using javascript to attach nodes to the DOM rather than creating svg tags in the html, viewable in IE.
    Message 1 of 1 , Nov 30, 2007
    • 0 Attachment
      I've been trying to draw a simple shape in an html page using
      javascript to attach nodes to the DOM rather than creating svg tags in
      the html, viewable in IE. I haven't been able to do it.

      The closest I've come is having an svg document:
      <?xml version="1.0" standalone="no"?>
      <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
      "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
      <svg width="300px" height="300px" id="svgdoc" version="1.1"
      xmlns="http://www.w3.org/2000/svg"></svg>

      and using some javascript to create an object element for FF and an
      embed element for IE that references the file with it's data and src
      attributes respectively and append them to the DOM. In FF, I can
      access the svg tag in the svg file and append to it any children I
      want to create using the DOM's appendChild and setAttribute functions.
      I can't get it to work in IE however. I can get a reference to the
      svg document in IE like so:
      document.getElementById('SVGid').getSVGDocument()
      but the problem starts here. I can't get IE to recognize any
      childNodes. FF will easily return the number of svg child nodes in
      the document but IE always returns 0.

      So... does anyone have any pearls of wisdom about how to create svg
      DOM nodes directly from javascript?

      TIA
      -sean
    Your message has been successfully submitted and would be delivered to recipients shortly.