Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    ew1
    ew1 is offline
    New Coder
    Join Date
    Mar 2004
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    Aug 2004
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    ew1
    ew1 is offline
    New Coder
    Join Date
    Mar 2004
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 Attached Files
    'Do or do not. There is no try.' --Yoda


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •