Execute dynamic HTML/JavaScript
<p>I'd like to create a textarea and a division so that whatever embed code you put in the textarea it gets executed on the division in real-time.</p>

<p>Your kind help is greatly appreciated!</p>

<p>JavaScript newbie</p>

<p>Here's an attempt:</p>

<pre><code>&lt;script type="text/javascript"&gt;
var X = " HTML or JavaScript "
window.onload=function()
{
document.getElementById("result").innerHTML = document.getElementById("input").value;
}
&lt;/script&gt;

&lt;textarea id="input" cols="35" rows="7"&gt; X &lt;/textarea&gt;

&lt;div id="result"&gt;&lt;/div&gt;
</code></pre>
