title: Open a new javascript window(.open) along with its CSS styling
body: <p>I'm trying to get this function to work on the website of a project I'm working on. The purpose of this function is to only (physically) print the contents of a child div which is coincidentally referred to as selector #content.</p>
  
  <p>Here's the little bit I've got 'till now:</p>
  
  <pre><code>&lt;script&gt;
      function printContent() {
          window.open().document.write($("#content").html());
          window.print();
          window.close();
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>The function is fired when a person clicks on a "print" hyperlink. The new window will load the contents of the #content div which is parsed from another HTML document:</p>
  
  <pre><code>&lt;div id="content"&gt;
      &lt;br/&gt;
      &lt;div id="Algemeen"&gt;
          &lt;h3&gt;Algemene informatie&lt;/h3&gt;
          &lt;fieldset id="profile"&gt;
              &lt;img id="male" src="./images/Pixers/male_icon.jpg"&gt;&lt;/img&gt;
              &lt;img id="female" src="./images/Pixers/female_icon1.jpg"&gt;&lt;/img&gt;
          &lt;/fieldset&gt;
      &lt;/div&gt;
      &lt;div id ="leftbox"&gt;   
          &lt;div id ="veldbox"&gt;&lt;label&gt;BSN:&lt;/label&gt;$!person.bsn&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Voornaam: &lt;/label&gt;$!person.first_name&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Achternaam:&lt;/label&gt;$!person.name_prefix $!person.last_name&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Geslacht:&lt;/label&gt;$!person.gender&lt;/div&gt;  
          &lt;div id ="veldbox"&gt;&lt;label&gt;Woonadres:&lt;/label&gt;$!person.address&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Plaatsnaam:&lt;/label&gt;$!person.location&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Provincie:&lt;/label&gt;$!person.province&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Postcode:&lt;/label&gt;$!person.zipcode&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Tel. nummer thuis:&lt;/label&gt;$!person.h_number&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Mobiel nummer:&lt;/label&gt;$!person.mobile_nr&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Burgerlijke Stand:&lt;/label&gt;$!person.m_status&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;land van herkomst:&lt;/label&gt;$!person.origin&lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="rightbox"&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Naam instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Adres instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Postcode instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Tel. instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Fax instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;E-mail instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;Website instantie:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;-:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;-:&lt;/label&gt;&lt;/div&gt;
          &lt;div id ="veldbox"&gt;&lt;label&gt;-:&lt;/label&gt;&lt;/div&gt;  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It just won't load the styling along with it. All the contents will all just be cropped up in the top left corner. I've tried linking the CSS through JS or by just putting it in the head of the page as suggested on another page. I could be doing this wrong of course. I haven't really tried figuring this out with JQuery yet, so if you have any other solutions that might help me with my problem, I'm happy and open to receive some advice about them.</p>
  
  <p>Thanks in advance!</p>