Solved

onafterprint in Netscape

Posted on 2002-07-11
3
164 Views
Last Modified: 2010-05-18
What I want to do is hide several elements of a page, print the page, then have the elements come back.  Code below.  Unfortunately, the elements come back before the user clicks Print.  I understand that I can fix that in IE 5.5, but I need a solution in Netscape 7.  Anyone know of a way to detect if the user has clicked Print?


     function ReturnTheButtons() {
          document.getElementById('CloseButtonTop').style.visibility = 'visible';
          document.getElementById('CloseButtonBottom').style.visibility = 'visible';
     }
     function PrintThisWindow() {
          document.getElementById('ClickToPrint').style.visibility = 'hidden';
          document.getElementById('InstructionText').style.visibility = 'hidden';
          document.getElementById('CloseButtonTop').style.visibility = 'hidden';
          document.getElementById('CloseButtonBottom').style.visibility = 'hidden';
          window.print();    
          ReturnTheButtons();
     }
0
Comment
Question by:DanR
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
Comment Utility
I know that Netscape 4 prints the page the way it looks when it initially loads. So even when you hide a certain element / layer and print then it will show.

I think this is also the case with Netscape 7. Try to keep the elements hidden when you load the page. Then after loading is complete you show them:

So make those elements hidden when the page loads, and add the following code:

function document_onload()
{
  // show elements here
}
window.onload=document_onload;

0
 
LVL 3

Author Comment

by:DanR
Comment Utility
Well, I may check that out, but for now, it looks like I'm going to have separate styles for screen and print.

But hey, you tried and I can't remember how to delete a question, so take the points.
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
Most generous! Thank you!

If you need additional help on this. Post it here :-)

CJ
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

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now