You can do this entirely on the client if (1) you either know the names of all the image files in the directory on the server or (2) you can construct them programatically at runtime.
The latter works for instance if the file names are something like image_1.png, image_2.png, image_3.png, ..., image_n.png, etc. If you can do either of these, you just do the following in a loop, where i is the index on the loop: image[ i ] = new Image(); // store away the reference for later image.onerror = function(){ /* this is my error handler */ }; image.onload = function(){ /* and I get here once the image loads successfully */ }; image.src = urlPath + constructFileName( i ); // go get the image urlPath would be something like 'localhost/currProject/images/', and constructFileName( i ) either pulls the name out of a prepopulated array, as in (1), or builds it as in (2). You can also get the image stream directly via an $.ajax( ) call and assign it to image.src on success:, but the above is I believe a bit simpler. Hope that helps, Howard On Nov 25, 8:14 am, Liam Potter <[EMAIL PROTECTED]> wrote: > any server side language. > > fr0st003 wrote: > > So what I could do is use something like PHP, to pull images from the folder > > place them into a array, use the math function to pull something at random > > then use Javascript to style the information. Would this be possible to do > > with Python? I have some experience with Python. And or Ruby? > > > craig.kaminsky wrote: > > >> BlueSky is correct. JavaScript that runs in the browser does not have > >> access to either a local or server-based file system. For that you > >> need either: (1) a classic server-side programming language (ala > >> BlueSky's notes for PHP, ASP.NET, ColdFusion, etc.) or (2) a site that > >> runs the Jaxer server from Aptana, which is an open-source server > >> running JavaScript on the server. Outside of those two sets of > >> options, you would not be able to pull images dynamically from a > >> folder (or database or XML file, etc.). You can, however, use jQuery > >> to create the previews as you mentioned...once you get you images > >> pulled that is! > > >> Do you know what server-side technologies your web host provides? I'm > >> sure I (or someone on the list :) could offer some assistance in the > >> type of server-side script you'd need to extract all the files or > >> images in a directory.