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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print all all html-files in a folder using a Java Script?

    Hi

    I'm new to this forum, and have close to no skills in javascripting.

    I'm an editor for my works monthly newsletter (web based). And of course some of our employees want to read it on paper.

    The thing I'm after is a javascript which makes it possible for me to place a "print all pages"-button on my newsletter. I'm thinking of using a SSI for this button.

    For each issue I store all the html-files in one folder, and my though is therefore: is it possible to write a javascript that prints all the html-files in one batch (one click)? If possible, will it print the files in random order? javascript = print all html-files in folder X

    If not possible, how could i set up a javascript that prints multiple defined (named) html-files by just one click? Can I then control the printing order?

    I've tried to search the formums and googled around, but haven't found a solution that suits my needs.

    Can someone help me?

    Thanks and regard!
    Bellybob

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    JavaScript has no IO capabilities. That means it can not read/write files from the server or client.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    That's not really what he needs. He needs to figure out if he can force the browser to print a document. If so, then how could he write a script, with a hard-coded set of urls, that would print page after page after page of different pages, all from within a single page.

    I don't know that it can be done, but his answer doesn't involve file I/O as I understand it.

  • #4
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Taking into account that JavaScript doesn't have IO capabilities and that Beagle believes bellybob just wants to print stuff out. I've created a pretty remedial JS and HTML solution.

    On a HTML page, you can run a function that'll pop up all the pages with an additional query string param (print=true). On the pages that it pops up, you include a function to search the url for the param and see if it should print. If so, run the window.print() function.

    I've included 4 files. Named with the testX.thml convention. 1-3 have text and the query string detection functionality. 4 has the option to "print all" pages. I've include the zip file.

    Maybe this will give you ideas for a better solution.
    Attached Files Attached Files

  • #5
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thx a lot Oakendin, I'll have a closer look at it on thursday, when i'm back at work.


  •  

    Posting Permissions

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