title: Add canvas to a page with javascript
body: <p>I am trying to use Javascript in order to add a canvas to one page which originally does not have one.
  I am trying to do the following:</p>
  
  <pre><code>var canv=document.createElement("canvas");
  canv.setAttribute("id", "canvasID");
  alert(canv.id);
  var c=document.getElementById("canvasID");
  alert(c.id)￼;
  </code></pre>
  
  <p>The problem is the the first alert(canv.id) results in canvasID, while the second alert is undefined because c is null.</p>
  
  <p>Can anybody tell me what am I doing wrong?</p>
  
  <p>PS: the code is designed to run under Greasemonkey so adding the canvas and its ID in the HTML itself is not a viable option.</p>