Log in

View Full Version : Print only contents of <DIV>



johnnyi
03-01-2006, 01:46 PM
Howdy folks,

Through the use of an onclick event such as:


<a onclick="window.print()">Print Me</a>

...is there a way to setup the print call to only print contents of a specified div tag? I messed around with a few iterations to no avail.

In other words, how could I go about printing only the contents of <DIV ID="Div1">?

Thanks - and let me know if you have any questions...

- I

mwinter
03-01-2006, 02:40 PM
Not as such, no. You can use a print style sheet to control what is and what isn't printed, and you could use scripting to change how it applies to the document, if necessary (with the usual caveat that users will get very different behaviour if scripting is disabled or lacking the necessary features).

Mike

johnnyi
03-01-2006, 03:46 PM
Thanks, Mike