File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Printing Pop up window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Printing Pop up window" Watch "Printing Pop up window" New topic
Author

Printing Pop up window

James Kerruish
Greenhorn

Joined: Aug 22, 2001
Posts: 16
I'm having problems printing the contents of a new window that I create under Netscape. When using IE everything seems to work fine. Under netscape when I try to print the contents of the new window it prints the contents of the original window that created the new window.
So from the main window I code:
DispWin = window.open('','NewWin','directories,location,toolbar,status,menubar,resizable,scrollbars =yes,width=600,height=600');
to open the new window and then I add text to it for example:
DispWin.document.write("<table cellpadding='5'> <tr> <td>");
etc
Then I need to be able to print this DispWin but like I say Netscape prints the original window instead of DispWin when print is pressed on the toolbar of the DispWin window.
Thanks
A1ien51 CNEUFOs
Greenhorn

Joined: Nov 05, 2001
Posts: 16
Where asre you trying to print this window from? The parent or the child(aka popup)??
James Kerruish
Greenhorn

Joined: Aug 22, 2001
Posts: 16
What happens is that a user enter some details about themselves in a form and when they press a button this opens a new window called DispWin which displays all the data the user has entered. This works fine but when I try to print the contents of the new window (by pressing print on the toolbar of the DispWin) it prints the orignal window with the form in it and not the contents of DispWin like I say this only seems to happen under Netscape.
Thanks
A1ien51 CNEUFOs
Greenhorn

Joined: Nov 05, 2001
Posts: 16
Got to love netscape...hehhee
okay lets see here, now are you writing this new pop up dynamically??
also here are some other things you can do and see if this works
print it from the other window
<input type="button" value="Print PopUp" onclick="DispWin.focus();DispWin.print()" name="PopPrinter">
you can also put the button on the popup
<input type="button" value="Print PopUp" onclick="window.print()" name="PopPrinter">
See if that works, if not, give me a link or something, and i might be able to figure it out

James Kerruish
Greenhorn

Joined: Aug 22, 2001
Posts: 16
Firstly thanks for your help although I seem no closer to an answer. I've tried the two suggestions you gave but no luck. I've put the page on a website although the page is all a bit rough at the moment and the code isn't very easy to follow. The key area you need to look at in the code is the function Display() this is the function that is activated when the user presses the display button after filling in the form and it writes the data to a new window.
Note that I having problems with netscape and I'm using version 4.7(I think), it works ok with version 6 and explorer(to my knowledge).
ok well the link is http://www.kerruish.co.uk/PopUp/entryform3.htm
like I say it's not that easy to follow so please ask any questions if you don't follow anything.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing Pop up window