Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
380 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

926 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