Create <svg> element and make circle - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:SVG

Description

Create <svg> element and make circle

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
var svg1 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg1.setAttribute("height",200);
svg1.setAttribute("width",500);
document.body.appendChild(svg1);
var circles = document.createElementNS("http://www.w3.org/2000/svg", "circle");
circles.setAttribute("cx",20);
circles.setAttribute("cy",20);
circles.setAttribute("r",20);
svg1.appendChild(circles);/*from  w w w  . j a va2s  .  c  o  m*/

      </script>  
   </body>
</html>

Related Tutorials