aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark ""print this page" link (for frames pages)" Watch ""print this page" link (for frames pages)" New topic
Author

"print this page" link (for frames pages)

Jimminy Bee
Greenhorn

Joined: Aug 26, 2004
Posts: 3
hi,

I am using HTML with frames. I have a top frame for a banner, a contents frame on the left, and a main frame. Links in the contents frame open pages in the main frame. The top frame and contents frames don't change.

Anyway, what I want to do is have a button (or text link) on the top form that says "print this page". When clicked it will print out the page in the main frame, whatever page happens to be loaded at the time.

Any help would be appreciated, thanks

edit: I have found this script on a website, how would I edit it to make it print the frames page?

a href='javascript:;' onKlick='window.print();return false'>Print this page.</a
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Switcher Switcher,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Note that JavaScript is not Java.

Moving this to the HTML and JavaScript forum...
[ August 26, 2004: Message edited by: Dirk Schreckmann ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
onclick="parent.FrameName.print()"
Jimminy Bee
Greenhorn

Joined: Aug 26, 2004
Posts: 3
hi, thanks, but it only prints out the frame in which the code is embedded - not the frame it's supposed to print out.

onklick='parent.main.print()'

That's the code I'm using, and I want to print out the frame called 'main' when the link's clicked on. However, it prints out the 'banner' frame every time. What's gone wrong?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
make sure that youur frames are named right....


This is the same thing:
http://www.codelifter.com/main/javascript/printframe.shtml
Jimminy Bee
Greenhorn

Joined: Aug 26, 2004
Posts: 3
Thanks for the link, I'm using that code and it works fine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "print this page" link (for frames pages)