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
362 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

813 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