p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript (http://p2p.wrox.com/forumdisplay.php?f=85)
-   -   window.print() ??? (http://p2p.wrox.com/showthread.php?t=68872)

RinoDM June 18th, 2008 08:04 AM

window.print() ???
Hi to all...

Using the window.print() is there a way i can tell it to print from point a to b on a page?

Thanking you in advance


Old Pedant June 18th, 2008 03:06 PM

Sort of.

What you can do is to create your page in "sections", perhaps using <DIV> tags?

<DIV id="section1">...</DIV>
<DIV id="section2">...</DIV>
<DIV id="sectionN">...</DIV>

Then, to print only one section, change the style of each of the others to display:none and print the entire page.

vinod_yadav1919 June 18th, 2008 03:18 PM

Hi RinoDM!!



Note- by putting display:none ,you need to again reset to display:block after printing it and if the page is long you will get some kind of flicker..

Cheers :)


RinoDM June 18th, 2008 03:44 PM

I'll take a look at try it...
Thank you...

Old Pedant June 18th, 2008 04:53 PM

Well, if you are *REALLY* careful you can do it without changing the *DISPLAY* at all!

That is, you set it up so that ONLY for print media are the other div's turned into display:none.

Would only work on browsers that allow className property (MSIE and FF, do, at least), but it's cleaner than having a flicker.

All times are GMT -4. The time now is 12:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.