title: How Can I Replace a Script Element?
body: <p>I want to remove a script element and replace it with a different one.
  Lets say that you</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="default.js"&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>What I want to do is remove default.js and replace it with new.js on the click of a button. I know you can create a script like this:</p>
  
  <pre><code>var new_scr=document.createElement('script'); 
  new_scr.src="new.js"; 
  document.getElementsByTagName('head')[0].appendChild(new_scr);
  </code></pre>