Javascript appending DIV tag dynamically
<p>I want to append the content of an already defined "old div" tag to the "new div" tag dynamically but as I'm new to javascript i don't have any idea that how to do this. The code i tried is attached below.
And one more question, how to remove that appended div tag dynamically?</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;

function add() {

var i = document.getElementById( 'old' );
var d = document.getElementById( 'new' );
d.appendChild( i );
}
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id="old"&gt;
Content of old div
&lt;/div&gt;

&lt;div id="new"&gt;
&lt;/div&gt;
&lt;button onclick="add"&gt;Add&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
