Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-24-2005, 04:38 PM   PM User | #1
ew1
New Coder

 
Join Date: Mar 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
ew1 is an unknown quantity at this point
Question site-wide printer-friendly print script

Hi,

I'm trying to create a printer-friendly javascript function that will be included on all pages of my site. I have a link on the page that calls a function called showPrintPage(). This is the code for that function:

Code:
function showPrintpage(){
document.getElementById("dontPrintTop").style.display = "none";
document.getElementById("dontPrintLeft").style.display = "none";
document.getElementById("copyright_td").style.display = "none";
document.getElementById("relatedlinks_td").style.display = "none";
document.getElementById("printerFriendlyRow").style.display = "none";
document.getElementById("hide").style.display = "inline";
window.print();
}
... on each web page via an include...

Code:
<a href="" class="printerFriendlyRow" onclick="showPrintpage();">Printer-friendly page</a>
It hides all the "fluff" navigational things and then prints the page. Right now I'm testing it on Netscape 7.1 and IE 6.0.

It works like I want it to in Netscape 7.1 but in IE 6.0, after some time, it refreshes to the index page in that current directory.

Any ideas on what is causing this?

Also, I'm trying to set the timeout to have a longer delay in refreshing on both browsers but haven't figured out the code for that part yet.

Thanks,

Patricia
__________________
'Do or do not. There is no try.' --Yoda
ew1 is offline   Reply With Quote
Old 03-24-2005, 04:55 PM   PM User | #2
afru
New Coder

 
Join Date: Aug 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
afru is an unknown quantity at this point
There is nothing wrong with the code you have posted...
May be there is something else you have ignored.
Please post ur whole page code....

Afru.
afru is offline   Reply With Quote
Old 03-24-2005, 08:25 PM   PM User | #3
ew1
New Coder

 
Join Date: Mar 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
ew1 is an unknown quantity at this point
Ok, I zipped it up for you. The main page is called typesOfLeaves.php and the other files are includes.
Thanks in advance for looking at all this!!
Attached Files
File Type: zip printer-friendly.zip (5.6 KB, 154 views)
__________________
'Do or do not. There is no try.' --Yoda
ew1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:08 PM.


Advertisement
Log in to turn off these ads.