title: Executing code from a text area
body: <p>I have a page that accepts Javascript code in a text area. I would like to run that code when the user presses the run button.</p>
  
  <p>Is the following possible:</p>
  
  <pre><code>var programFunction = new Function(document.getElementById('program').value);
  
  &lt;button type="button" onclick="programFunction"&gt;run&lt;/button&gt;
  </code></pre>
  
  <p>Let's say the textarea program has the following in it:</p>
  
  <pre><code>document.getElementById('program').value = 'Tested';
  </code></pre>
  
  <p>When I try to test this myself, I don't get any errors but I also don't get any output.</p>