473,506 Members | 16,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I print a parent window?

1 New Member
First off, I am new to using Javascript, so I apologize if I am asking dumb questions.

I am attempting to print a parent window from a pop-up. I know how to use Javascript to print a window normally, but I can't seem to get it to print the parent. It reverts to printing the child.

Any tips?

Also, if there is text that is highlighted in the parent window, will I be able to have just the selected text print from the print command in the child?

Thanks for any help you can provide! Its appreciated.
Oct 31 '06 #1
1 2770
acoder
16,027 Recognized Expert Moderator MVP
Access the parent and then call the print() method:
Expand|Select|Wrap|Line Numbers
  1. window.opener.print()
To print only the highlighted text, you will need to hide the rest of the page. Set the styles of the elements that should not be printed to "display:none" with javascript:
Expand|Select|Wrap|Line Numbers
  1. elem.style.display = "none";
Then call the print() method. Then show the elements again by setting display to "block".
May 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4886
by: Brett | last post by:
I have a frame (frame1) with data in it that is in a table. I'd like to print the data without any HTML. I believe this is the same as if I had the frame window open as a stand alone window and...
3
9401
by: Marcus Bjorke | last post by:
I use a print link that causes a problem with Opera 7. The link looks like this <a href="javascript:parent.frames.mainFrame.print()">Print this page</a> I also used <a...
4
6229
by: Scott Navarre | last post by:
Hello, I have 2 frames. The top one is the control frame and the bottom one is the display. I have a roll-over button in the top frame that I want to use to do a print() for the bottom frame....
3
8339
by: Craig | last post by:
First of all, this one is driving me crazy, so thanks in advance for any help!! I've got a javascript function in a parent document that generates an HTML document on the fly when a button is...
1
8793
by: nospam | last post by:
All I am trying to achieve the following: Main window page's asp code writes the following line to launch a popup window (note the IFRAME has to be in the popup window, it cannot be in the...
5
3001
by: Erik | last post by:
My main web page has a print button, and when pushed a new page should load, be printed automatically, and then the page should be closed. The control should be back at the main page and the user...
2
1701
by: John Kotuby | last post by:
Hi all, Again running into problems converting existing ASP to ASP.NET 2 in VB. I am simply trying to print a portion of the HTML displayed on-screen and not the entire document. Specifically I...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.