June 22nd, 2001, 07:13 AM
I have a page divided up into two frames. The top frame contains information, while the bottom frame contians my navigation buttons and a print button. When a user clicks on the print button I have it set up to print the top frame. This works fine except that it closes the window when the printing starts. Does anyone know why it does this. I don't want the window to close. I do not have any code in there to cause the window to close. The print button is set up like this.
<input type=image src="Graphics/print.jpg" name=cmdprint value=Print onClick=top.frames.CallPrint() border=0>
In my top frame I have set up the following function.
June 22nd, 2001, 08:28 AM
Nothing in the refs on print doing anything dirty.
How about that self.focus() ?
Hmm, nah, probably nothing wrong with that either.
It's close that doesn't work on individual frames, focus should work just fine.
You're not using a print _button_ btw.
Do you have "Display a notification about every script error" turned on?
June 22nd, 2001, 08:36 AM
Browser IE 5.5, haven't tried netscape 6 yet.
I am just using a regular image button, the client did not want the buttons to display on the print out page, that is why I am using frames. I place my buttons on the bottom frame to control the top frame. So that when they print only the contents of the top frame gets printed. The focus is there for older browsers, I read that for IE 4 and Mac IE 4, the frame you want to print has to recieve focus first.
I do have display notification turned on, but it is not returning anything, that is why I am stumped. It almost seems that the window is tied into the print window. Because when I hit cancel on the print window, that closes my browser as well. It is really wierd.
June 22nd, 2001, 08:46 AM
What happens if you try to print a normal webpage through File >> Print?
What's in your File >> Page Setup.. ?
Have you tried printing a normal webpage (no frames) with window.print()?
Having some doubts about that self.print(). What exactly is self referring to? Ah, to the window I guess. Well, you could try window.print() instead, but I don't think there's a difference.
June 22nd, 2001, 08:51 AM
There is a difference between window.print() and self.print()
Window.print() will print the entire window. Including the bottom frame with the buttons. self.print() prints just the frame with the focus. It is the same as saying top.frames.print().
June 22nd, 2001, 09:06 AM
Does this work:
Put this function in the onClick of your Print button
(yes, I know you said that window.print prints the entire window, but it really shouldn't do this cause your frame == window)
I found some examples on the net and they all say that if you want to print frame B, you have to call the print function from frame A. Doesn't make any sense to me, but perhaps that is what's causing your problem.