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
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
Suggested Courses

624 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