Print content of page javascript

 The following code creates a hyperlink and uses the Javascript print function to print the current page:
<a href="JavaScript:window.print();">Print this page</a>

  1. function PrintContent()
  2. {
  3. var DocumentContainer = document.getElementById('historyListPanel');
  4. var WindowObject = window.open('',  
    "TrackHistoryData",
  5. "width=740,height=325,top=200,
    left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");
  6. WindowObject.document.writeln(DocumentContainer.innerHTML);
  7. WindowObject.document.close();
  8. WindowObject.focus();
  9. WindowObject.print();
  10. WindowObject.close();
  11. }
  1. pass your table id or div id or contentid

0 comments: