Solved

How do I print another frame in a frameset from javascript in IE7, as if I right-clicked on the frame and chose print?

Posted on 2008-10-01
2
356 Views
Last Modified: 2013-12-08
I have a web application that is laid out in a frameset. Some users requested a button that enables them to print the contents of one specific frame, rather than the whole frameset. I tried in javascript parent.frames[4].print(); (4 is the index of my content frame in the frames collection) - however this printed the frame in which the button calling this javascript resides. In simpler terms: Frame 2 has <input type="button" value="print" onclick="parent.frames[4].print();" />. Clicking that button prints frame 2, not frame 4 as i specified.
If I rightclick on frame 4 from the browser and click print, i get my content frame, frame 4. How can I replicate this functionality from javascript?
0
Comment
Question by:colonel720
2 Comments
 
LVL 7

Accepted Solution

by:
ljubiccica earned 125 total points
ID: 22621588
Hey there!

You can try this thing I just found: before printing some frame, it needs to have the focus (on it).

So try this one: onclick="parent.frames[4].focus();parent.frames[4].print();"

Hope it will work for you,
ljubiccica
0
 
LVL 1

Author Closing Comment

by:colonel720
ID: 31502198
Awesome, that did the trick.
Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now