title: Creating SVG elements dynamically with javascript inside HTML
body: <p>I want to create a rectangle inside an HTML page, then write some text on that rectangle. I also need that text to be a hyperlink. This is what I did but it is not working:</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;script&gt;
  
      var svg   = document.documentElement;
      var svgNS = svg.namespaceURI;
  
      var rect = document.createElementNS(svgNS,'rect');
      rect.setAttribute('x',5);
      rect.setAttribute('y',5);
      rect.setAttribute('width',500);
      rect.setAttribute('height',500);
      rect.setAttribute('fill','#95B3D7');
      svg.appendChild(rect);
      document.body.appendChild(svg);
  
      var h=document.createElement('a');
      var t=document.createTextNode('Hello World');
      h.appendChild(t);
      document.body.appendChild(h);
  
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can you help please? 
  Thanks.</p>