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 9 of 9
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    count subfolders and pass on values of array length to other page?

    Is it possible to let's say I have this folder structure

    A (count.html)
    - B
    01-B
    04-C
    05-D
    01-X

    To do a JS that counts just the amount of folders that reside in subfolder B from a page(count.html) that resides at toplevel A

    another similar case:

    I have an array of images that displays the length of that array with photoarray.length in a page x1.html

    Can I pass that value (the array length number) to a page residing at the same level x0.html (in the same folder if you will)

    Any ideas?

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    I am assuming either this is server-side javascript or is an HTA or other trusted script allowed to access the file system.
    Given that, you can use Scripting.FileSystemObject to count things.
    You can pass anything you want, pretty much, via the URL.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts
    about the JS:
    HTA nope
    client-side yes
    server-side nope

    why? ISP in this case: no cgi-bin or other, therefore relying client-side JS

    there is only seems a way to pass variables accross pages by means of a topFrame, (maybe?) inline frame, cookies (if enabled ?), and server-side (no option here)

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    You can pass variables in the URL.
    You cannot access the server file system from client-side JS alone.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I'm not sure, but I guess that you need to have in a page a variable which is the number of the picture in a given folder. This variable will help you to give a limit to an array for a dynamic circling through the pictures. Am I right?

    If so, one of the methods is to use a server-side include in your page which will counts the number of the files than create a small javascript code and writes there that variable. For instance, my programmers use php language code for this stuff.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #6
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    That would work great, but he said there was no server-side scripting.

    Personally, I wouldn't be trying to make a site if the host had no server-side scripting. Web hosts are cheap these days. Move.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #7
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    In this case the only solution is to write that variable in the page (or in an external js file whever new pictures are sent to / remove from that folder. No other way. I have tried once to build javascript aplication which must have verfied if a file really exist (for instance when creating a new element to check it's offsetWidth) but the loading process is ussualy much slower that the code's speed, so it was a failure.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #8
    Regular Coder
    Join Date
    Mar 2005
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for all your thoughts.

    - Counting folders seems impossible with only client-side JS.
    - Passing variables from one page to another with JS, seems possible. Inline frame would that be a good option? would like an example if possible with inline frame
    Last edited by _com; 10-14-2005 at 06:46 PM.

  • #9
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Inline frame?
    From parent to child:
    document.childFrameName.document.formname.hiddenElementName.value=parentVariableName;

    I think most browsers let you also do:
    document.childFrameName.childVariableName=parentVariableName;

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

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