SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast overbyte's Avatar
    Join Date
    Jun 2003
    Location
    yes, he said exactly london, england
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question javascript:print() on link

    i have used a loadvars.send to get some (POST) variables into a php page which formats them and should have a link to print ... which doesn't work (i've tried a button but that doesn't work either).

    PHP Code:
    //printmail.php - the php script works fine - it's just here for context

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Print Form</title>
    </head>

    <body>
    <?php

    $myName
    =$_POST["myName"];
    $myBody=$_POST["myBody"];
    $myPhone=$_POST["myPhone"];

    $htmlBody.="<p>Name : $myName<br>";
    $htmlBody.="Telephone : $myPhone<br></p>";
    $htmlBody.="<p>To me me. Here is my wishlist.</p>";
    $htmlBody.="<p>Order : $myBody</p>";

    echo(
    $htmlBody);

    ?>

    //this is the bit that doesn't work
    <a href="javascript:window.print();">Print this page.</a>
    </body>
    </html>
    does anyone know why the link doesn't work?
    ;oB

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What browser are you using? It doesn't work across the board you know. I'm pretty sure it's not a "standards" function...

  3. #3
    SitePoint Enthusiast overbyte's Avatar
    Join Date
    Jun 2003
    Location
    yes, he said exactly london, england
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm on mac and i've tried using safari (mozilla) and ie5.2
    ;oB

  4. #4
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't think of a page with that feature on and I'm feeling lazy! If you send me a link I can try it on 6 different browsers for you though and report back.

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by greg.harvey
    What browser are you using? It doesn't work across the board you know. I'm pretty sure it's not a "standards" function...
    window.print() is standard, but Mac browsers are notorious for their lack of support for it for some reason. IE/Mac and Safari don't support it, but Mozilla-based Mac browsers do .

    More info: http://rino.bowdoin.edu/blog/archive...miss_you.shtml

  6. #6
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is javascript: print(); just IE though, even if window.print(); is standards? Or was I misinformed...? I seem to remember that the former never worked in NN4 either.

  7. #7
    SitePoint Enthusiast overbyte's Avatar
    Join Date
    Jun 2003
    Location
    yes, he said exactly london, england
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did anything work for nn4: officially the most broken browser in the world to give it's full name

    the link is http://memelifestyle.com/printmail.php
    ;oB

  8. #8
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm... works on all PC browsers I have available:

    Netscape 6
    Netscape 4
    IE 6
    Opera 6
    Mozi 1.4


  9. #9
    SitePoint Enthusiast overbyte's Avatar
    Join Date
    Jun 2003
    Location
    yes, he said exactly london, england
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot

    check this out http://www.baseboard.net/forums/show...951#post121951

    sock on the baseboard site found a cool way around it (way better than what i was going to do which is say "urm we reserve the right for this button not to work" to the 90% of users that it will work fine for)

    schweet

    thanks guys
    ;oB

  10. #10
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice!


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
  •