How to execute user given js?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/13243563/execute-javascript-from-textarea">execute javascript from textarea</a>  </p>
</blockquote>



<p>Is it possible to have an execute command? i have a concept below</p>

<pre><code>&lt;textarea id="txtbx"&gt; Enter code here &lt;/textarea&gt;
&lt;button onClick="executeusercode()"&gt;
&lt;iframe id="window"&gt;&lt;/iframe&gt;
&lt;script&gt;
    var executeusercode = function()
    {
        var c = document.getElementById("txtbx")
      // c.execute("window") (?)
&lt;/script&gt;
</code></pre>

<p>Also, what is wrong with this?
it gives: </p>

<blockquote>
  <p><code>Uncaught TypeError: Object #&lt;HTMLTextAreaElement&gt; has no method 'eval'</code></p>
</blockquote>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;body&gt;
        &lt;iframe id="window" &gt;&lt;/iframe&gt;
        &lt;script&gt;
            var executeusercode = function()
           {
               var c = document.getElementById("txtbx")
               c.eval(c)
           }
        &lt;/script&gt;
       &lt;textarea id="txtbx"&gt; Enter code here &lt;/textarea&gt;
        &lt;button onClick="executeusercode()"&gt;Hi&lt;/button&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
