javascript - Get a sequence of images into an array -
i wondering if it's possible sequence of pictures array. i'd use plain javascript, because have 0 experience in php or other language achieve this.
so created map called "images", contains 50 images. first 1 called: "1", second 1 called: "2" , on. same type (.jpg).
i can manually like:
var pictures = new array(); pictures[0] = "images/1.jpg"; pictures[1] = "images/2.jpg"; //and on
but mad man this. when upload new picture "images" folder, have manually add new image array, thinking while loop checks if each image in folder stored array.
you try:
var pictures = new array(); for(var x=1; x<51; x++ ) { pictures[x-1] = "images/"+x+".jpg"; }
Comments
Post a Comment