SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist spoondevil's Avatar
    Join Date
    Jun 2001
    Location
    Harlow, Essex, UK
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Open Print Dialog on Window Load - or something like that...

    I have created a "Printer Friendly" page so users can print out the pages oon the site without having all the graphics on the page, but they have to click a link, such as:
    Code:
    <a href="print.php?m_id=#" target="_blank">Printer Friendly Page</a>
    but then they have to go up to the file menu, or click another link to print it, such as:
    Code:
    <a href="javascript:window.print()">Print This Page</a>
    Is there a way to get the print dialog box to open automatically when the printer friendly page opens?

    Ta
    Ian

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Try placing this piece of code in the head of your document:

    HTML Code:
    <script type="text/javascript">
     window.onload = function() { window.print(); }
    </script>
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Evangelist spoondevil's Avatar
    Join Date
    Jun 2001
    Location
    Harlow, Essex, UK
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Worked a treat.

    ta for that


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
  •