Using createElement to create a new table
<p>Why doesn't the following works? Don't tell me is cos table can't contain in a div...</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>
