Print Just Part Of The Page

[Total: 0    Average: 0/5]

This shows how to organize a page so that you can print just part of that page.

Body Code:

<script type=text/javascript>
var _h1 = "<html><head>";
var _h2 = "</head>";
var _b1 = "<body>";
var _b2 = "</body></html>";
var _part1 = "Hi There! This is part 1 of this <big>page</big><BR>more of part 1";
var _part2 = "This is the second portion of this <small>page</small><BR>last of it is here";
document.write(_part1);
document.write("<BR>");
document.write("<BR>");
document.write(_part2);
document.write("<BR>");
document.write("<a href='javascript:printIt(1)'>Print Part 1</a>");
document.write("<BR>");
document.write("<BR>");
document.write("<BR>");
document.write("<a href='javascript:printIt(2)'>Print Part 2</a>");
var win=null;
function printIt(_i) {
  win = window.open();
  self.focus();
  win.document.open();
  win.document.write(_h1+_h2+_b1+eval("_part"+_i)+_b2);
  win.document.close();
  win.print();
  win.close();
}
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *