View Full Version : Printing 1 frame only

04-23-2004, 09:49 PM
I am new to Java Script. I am creating a web site with three frames. The first displays the banner, 2nd the nav bar, and the third is the main document layout.
How do I specify that I want only the main frame to print and not the banner and the nav bar. I appreciate any help I can get!
Thank you,

04-23-2004, 10:10 PM
Truly, it's a function the user can override inside the print dialog -- but you can (in IE at least) do this:

document.onbeforeprint = top.frames.mainFrame.focus;

and it'll make the content frame the currently focused frame, to which the print dialog usually responds.

04-26-2004, 08:12 AM
Or you can put a print button in the main frame:

<input type="button" value="Print" onclick="window.print()" />

or a link

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

You can use CSS to make them unprintable.

<style type="text/css">
@media print
.displayOnly {display: none;}
<input type="button" value="Print" onclick="window.print()" class="displayOnly" />
<a href="#" onclick="window.print();return false" class="displayOnly">Print</a>

04-26-2004, 06:47 PM
Thank you so much! :thumbsup: ;)