Javascript and ASP Collections

Results 1 to 2 of 2

Thread: Javascript and ASP Collections

  1. #1 Guest

    Default Javascript and ASP Collections

    I had a problem with accessing ASP Files Collection with Javascript, I got the collection with<BR><BR>&#060;%<BR>fso = Server.CreateObject("Scripting.FileSystemObject"); <BR>f= fs.GetFolder("D:zips").Files;<BR>%&#062;<BR><BR>No w I can see how many files there are with f.count , and access the files specifically with f("filename.ext"), but I can&#039t get a list of them, as f(1) gives an error and f.item(2) gives an error also, the folder is there, and there are more than 3 files in it. I can get a list of items with other collections , why not with this one? Any advice please?

  2. #2
    jason Guest

    Default RE: Javascript and ASP Collections

    Generally you need to use the Enumerator object to loop through collections in ASP - full details are in the JScript Reference, link to the left.<BR><BR>roughly <BR><BR>var coll = new Enumerator(objfolder.files)<BR><BR>for(x=0;x&#060; objfolder.files.count;x++) {<BR>response.write(coll(x))<BR>}<BR><BR>i may have the details wrong, this is a quick answer!<BR><BR>jason<BR>

Posting Permissions

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