?
Solved

onafterprint in Netscape

Posted on 2002-07-11
3
Medium Priority
?
214 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 200 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…
Suggested Courses

840 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