javascript - loading files (with regular expressions) in JS -


i have bunch of images foldered this:

/first/345.jpg /second/12.jpg /third/394.jpg /fourth/234.jpg /fifth/5.jpg 

i'm trying go through folders , load image contained. there 1 image in each folder. how can tell javascript choose image, regardless of name?

look @ code:

for (var i=0; i<dirlist.length; i++) { // dirlist array containing folder names      something.load.image("c:/.../"+ dirlist[i] +"/"+ anydigit + ".png"); } 

how can replace "anydigit" make work? regular expressions? thank you!

just tested this. following list png in directory 1/ , 2/

var dirs = ['1/', '2/']; $.each(dirs, function(i, dir) {   $.ajax({     url: dir,     success: function(data) {       $(data).find("a:contains(.png)").each(function() {         var href = $(this).attr('href');         $('<p></p>').html(href).appendto($('div'));       });     }}); }); 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -