• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"print this page" link (for frames pages)

 
Jimminy Bee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onclick="parent.FrameName.print()"
 
Jimminy Bee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make sure that youur frames are named right....


This is the same thing:
http://www.codelifter.com/main/javascript/printframe.shtml
 
Jimminy Bee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link, I'm using that code and it works fine
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic