Results 1 to 6 of 6

Thread: Java Script print question

  1. #1
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Script print question

    hey all javascript guru's out their , i want to know if this is possible or not as i am getting mixed responces , what i want to do is , print a external document such as worddocument.doc from a html page , so click a buton and it will print the linked document , any help would be appreciated , cheers, regards Rick

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No.  
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    so what if i made the .doc files into a HTM document , is it then possible ? to click a print button and it will print the htm doc ?

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    If you were to make it plain text (or an HTML document), then yes you could print it out normally. Otherwise, no.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok awsome , would you know of a script that would do this ? cheers

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <script type="text/javascript">
      function latestElement() {
        var e = document;
        while(e.lastChild && e.lastChild.lastChild)
          e = e.lastChild;
        return e;
      }
    
      if(window.print) {
        var a = document.createElement("a");
        a.appendChild(document.createTextNode("Print"));
        a.href = "#";
        a.onclick = function() {
          print();
          return false;
        };
        latestElement().appendChild(a).appendChild(document.createTextNode("Print"));
        a = null;
      }
    </script>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •