title: How to use createElement to create a new table?
body: <p>Why the following code doesn't work?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript"&gt;
      function addTable() {
          var table = document.createElement('table');
          table.innerHTML = "&lt;tr&gt;&lt;td&gt;123&lt;/td&gt;&lt;td&gt;456&lt;/td&gt;&lt;/tr&gt;";
          document.getElementById("addtable").appendChild(table);
      }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;input type="submit" value="New Table" onClick="addTable()"/&gt;
      &lt;div id="addtable"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>