title: Does this not work because I can't use a script in a div?
body: <p>I am making a website with a program editor, for users to make HTML programs.
  I usually test this out by inputting <code>&lt;script&gt; alert("Hi!"); &lt;/script&gt;</code> into the <code>body</code> input area, but no alert comes. As you can see from the code, the result is the script ending up inside the <code>div</code>.
  So do <code>script</code>s work in <code>div</code>s? If they do, here's my code (the important part, at least):</p>
  
  <p>This is my script to run when I press the "Run!" button:</p>
  
  <pre><code>&lt;script&gt;
      function onclick(){
          document.getElementsByTagName("head")["0"].innerHTML += eval(document.getElementById("editorHead").value);
          document.getElementById("result").innerHTML = eval(document.getElementById("editorBody").value);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>This is the code for the input areas &amp; run button (omitting the text between them &amp; class attributes):</p>
  
  <pre><code>&lt;textarea id="editorHead" rows="20"&gt;&lt;/textarea&gt;
  &lt;textarea id="editorBody" rows="20"&gt;&lt;/textarea&gt;
  &lt;div id="result"&gt;&lt;/div&gt;
  &lt;button onclick="onclick();"&gt;Run!&lt;/button&gt;
  </code></pre>
  
  <p>I tried changing the <code>onclick</code>'s name to <code>run</code>, and that made the clicking work (before that the button wouldn't turn blue when you clicked it), but that was it.</p>