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 9 of 9
  1. #1
    New Coder
    Join Date
    Oct 2004
    Location
    Sydney
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print page (launch print version document)

    hi,
    been looking for the code but cant find it.

    i want to add a link to page "print this page" onClick i want it to open a hidden window(print version html document), then open the Print dialoge box so the user can select OK.

    anyone???

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    <p align="center"><center><font size="1" face="Arial"><b><a href="#" onclick="javascript:window.print()">Click here to print this page</a></b></font></p>

    Why make the user confirm what he has already requested, namely print the page?

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New Coder
    Join Date
    Oct 2004
    Location
    Sydney
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Re: yeah this is exactly what i wanted - word document... the code in the HEAD worked fine... but i couldnt work out to link the "print this page" back to the code in the HEAD.

  • #5
    New Coder
    Join Date
    Oct 2004
    Location
    Sydney
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.jsmadeeasy.com/javascript...or%20Printing/

    Just found this...
    So I misinterpreted what this code actually means. 1) u don’t need a button saying "print this page", you just hit the browsers Print bttn and it werks....

    that’s actually pretty shmick.

  • #6
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    in the head of your document, put this:

    Code:
    <link rel=alternate media=print href="file_you_want_printed.html">
    or as a link use this
    Code:
    <a href="file_you_want_printed.html" onClick="window.print();return false;">Print other Doc</a>
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #7
    New Coder
    Join Date
    Oct 2004
    Location
    Sydney
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by canadianjameson
    in the head of your document, put this:

    Code:
    <link rel=alternate media=print href="file_you_want_printed.html">
    or as a link use this
    Code:
    <a href="file_you_want_printed.html" onClick="window.print();return false;">Print other Doc</a>
    OKAY. i've tried both codes and it still doesnt work... this is where i have put it....

    <link rel=alternate media=print href"zprint_home.html">
    </script>

    </head>

    ***********************

    doenst seem to work
    www.finser.com.au

  • #8
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    Did you try both at once?

    check the source code of this page:

    www.enviromark.ca/english/linecard.html

    at the very top there is the first part, and the actual link is the print icon

    tell me if you still cant get it working

    aswell in the example you provided you're missing an = after the href
    Last edited by canadianjameson; 11-15-2004 at 04:48 AM.
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #9
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    on a personal note, i checked the link you gave. do you have any other pictures of water like that.

    i'm looking for some.

    on the page i provided, if you click on the print icon it does print the alternative link
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)


  •  

    Posting Permissions

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