Forum Moderators: open

Message Too Old, No Replies

Opening Print preview Window from a text link

Print Preview window

         

bj75

2:04 am on Sep 13, 2005 (gmt 0)

10+ Year Member



Is it possible to open the print preview window in browsers using javascript on a text link from within the page.

gugenot

10:38 am on Sep 19, 2005 (gmt 0)

10+ Year Member



create two css classes for BODY:

/* here come usual styles */
BODY {
...
}
BODY DIV.menu {
...
}

/* here come elements styles for print version */
BODY.print {
...
}
BODY.print DIV.menu {
display: none;
}
and so on..

and then set onclick containing something like:
document.getElementsByTagName('BODY')[0].className = 'print';

devic

2:47 pm on Sep 19, 2005 (gmt 0)

10+ Year Member



<a href="#" onclick="window.print();return false;">print this page</a>