hallo,
I am building a website and I would like to have a different banner background picture everytime the page loads. I would like the javascript code to count the available pictures (they are in a specific folder on the server: banner_img/) and then it should produce an array with the names of the pics, and finally assign randomly one to the background. The aim is: I would be able to add/remove pictures from my folder without the need to alter the javascript.
My question is: can I count files in this folder? Do you have an example on how to do it? Thanks
I am building a website and I would like to have a different banner background picture everytime the page loads. I would like the javascript code to count the available pictures (they are in a specific folder on the server: banner_img/) and then it should produce an array with the names of the pics, and finally assign randomly one to the background. The aim is: I would be able to add/remove pictures from my folder without the need to alter the javascript.
My question is: can I count files in this folder? Do you have an example on how to do it? Thanks