title: Printing InnerHtml
body: <p>Can someone tell me why 'printArea' in Javascript is comming up as undefined.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script language="text/javascript"&gt;
      function printArea(areaName)
      {
          var printContents = document.getElementById(areaName).innerHTML;
          var originalContents = document.body.innerHTML;
  
          document.body.innerHTML = printContents;
  
          window.print();
  
          document.body.innerHTML = originalContents;
      }   
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="printThis"&gt;
    Hello I am a printable area
   &lt;/div&gt;
   &lt;input type="button" onclick="printArea('printThis');" Value="Print"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the JS Fiddle
      <a href="http://jsfiddle.net/cFeNp/" rel="nofollow">http://jsfiddle.net/cFeNp/</a></p>