jQuery in Action, 2nd edition
The moose likes HTML, CSS and JavaScript and the fly likes Printer friendly page with javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Printer friendly page with javascript" Watch "Printer friendly page with javascript" New topic
Author

Printer friendly page with javascript

raghavendra pola
Greenhorn

Joined: Jan 18, 2007
Posts: 11
Hi guys ,
I have following page to display the printer friendly page of a current page using javascript

the following is the javascript



The problem is that after displaying the printer frriendly page , the focus is shifting back to main window from print friendly window.

So when window.print happens , it is printing the main window instead of printing the printer friendly window.

Can somebody please help me with this .


perfection is making best effort within constraints of space ,time and resources
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56180
    
  13

Put the print operation in the sub-page.

P.S. There are better ways to create printer-friendly pages. Look up CSS print media.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6


should be



You really do not need to use JavaScript, you can learn about CSS Print Media

Eric
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Printer friendly page with javascript
 
Similar Threads
Multiple Actions issue in JSF
Textarea not being passed OK through form
Javascript error :object expected
java Script Program
Textarea not being passed OK through form