Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing frames issue?

Status
Not open for further replies.

Craigieboy

Programmer
May 25, 2001
71
GB
Hi everyone!

I have a two frame browser window - a contents frame and a main display frame. I wish to add a print button to the contents menu which will print whatever the main page contains.

Can someone tell me how to add a button in one frame that prints the contents of the other frame?

Thanks in anticipation for your help.

Craig ;-)
 
parent.top.frames[1].document.print();

You may need to cash the .document to make it:

parent.top.frames[1].print();

One way or the other should work.
penny.gif
penny.gif
 
Thanks link9 for your reply.

The two examples you provided didn't actually work for me, but definately did get me to thinking along your lines and found that writing a little function within the <head> tags did the trick...

<script language=&quot;JavaScript&quot;>
<!-- Begin

function printframe() {
window.parent.framename.focus();
window.print();

}
// End -->
</script>

... then on my button I just call onClick=&quot;printframe()&quot; and bingo!

Thanks for making things clearer for me link9.

Craig :) ~~ Craigieboy ~~
 
I wonder if:

window.parent.framename.print();

would work?
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top