print() an element based on its id
<p>I would like to print only a table from a webpage whose id is <code>"test1"</code></p>

<pre><code>function printPage() { 
  $var = document.getElementById('test1');
  print($var); 
}
</code></pre>

<p>In print preview, the whole document is appearing and not the table. Most likely the entire page will be printed while all I want is my table to be printed.</p>
