...

View Full Version : site-wide printer-friendly print script



ew1
03-24-2005, 04:38 PM
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:



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...



<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

afru
03-24-2005, 04:55 PM
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.

ew1
03-24-2005, 08:25 PM
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!! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum