is it possible to register event handler like this?
<p>Why doesn't it work?</p>

<pre><code>&lt;body&gt;
    &lt;p id="element_id"&gt;
        blah
    &lt;/p&gt;


&lt;/body&gt;




var pcontent = document.getElementById('element_id').innerHTML;

function exit(){

document.getElementById('id2').innerHTML = pcontent;

}

var a = '&lt;div id="id2"&gt;&lt;input type="button" value="exit" onclick= "exit()"&gt;&lt;/div&gt;' ;


document.getElementById('element_id').innerHTML= a;
</code></pre>

<p><a href="http://jsfiddle.net/B94kx/" rel="nofollow">http://jsfiddle.net/B94kx/</a></p>
