Solved

onafterprint in Netscape

Posted on 2002-07-11
3
177 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
ID: 7148738
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
ID: 7148960
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
ID: 7148966
Most generous! Thank you!

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

CJ
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

809 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