title: Running Javascript in new window.open
body: <p>I'm running this function to open a new window.</p>
  
  <pre><code>function htmlNewWindow(id) {
      var html = $(id).html();
      var newWindow = window.open('');
      newWindow.document.body.innerHTML =  '&lt;html&gt;&lt;head&gt;&lt;title&gt;Hi&lt;/title&gt;  &lt;script src="js/myScript.js"&gt;&lt;/script&gt; &lt;/head&gt;' + html;    
  }
  </code></pre>
  
  <p>This successfully creates a new window with the HTML in it. I have a bunch of HTML tags which when clicked run a function called Foo1. I've tried printing the entire function of Foo1 to the new HTML document, and tried putting Foo1 inside myScript.js. I see both Foo1 inside a script tag in the new window, and  but neither are loaded since they are just written to the new page as HTML.</p>