SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Print Link that executes browser's print function?

    What do I need to do in order to have a link on a page that will execute the browser's print command?

  2. #2
    SitePoint Evangelist sputza's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jip
    What do I need to do in order to have a link on a page that will execute the browser's print command?
    That feature can be done using javascript. I found a premade script for you at dynamic drive.
    Steven Watkins
    Chief Web Ninja
    Code Monkey Interactive
    lowgravity.ca

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2005
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Steve - it is greatly appreciated!

  4. #4
    SitePoint Evangelist sputza's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No Problem. Feel free to PM me if you need more help in the future.
    Steven Watkins
    Chief Web Ninja
    Code Monkey Interactive
    lowgravity.ca

  5. #5
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would do it something like this.
    Code:
    window.onload = function(){
     if(!window.print || !document.createTextNode) return;
     var a = document.getElementById("print");
     a.appendChild(document.createTextNode("Print this page"));
     a.href = "javascript:window.print();";
    }
    HTML Code:
    <a id="print"></a>
    Simon Pieters


Bookmarks

Posting Permissions

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