Click to See Complete Forum and Search --> : image array created from directory
folsombob
01-09-2003, 11:24 PM
Hi, All
I've been working on some image scripts with arrays for a slideshow.
It works splendidly.
However, at present I have to manually enter each image that I wish to appear in the array.
Is there a way to create an index (wrong term?) for the array that would automatically create an image array from whatever images are in a given directory?
I've tried something like 'images/' + name + '.gif' but to no avail.
Thanks in advance,
vickers_bits
01-10-2003, 04:20 AM
there certainly is, unfortunately not in client-side javascript (to my knowledge anyhow)
if you can use ASP it's pretty easy
folsombob
01-11-2003, 04:06 AM
Originally posted by vickers_bits
there certainly is, unfortunately not in client-side javascript (to my knowledge anyhow)
if you can use ASP it's pretty easy
Thanks for the reply, vickers_bits.
Unfortunately, I don't use ASP -- or should I say "yet". :-)
You can also use PHP,Perl etc., just any server side language!
folsombob
01-12-2003, 02:34 AM
Originally posted by swon
You can also use PHP,Perl etc., just any server side language!
Thanks, once more, swon.
folsombob,
I think you can make it work with this code. I just downloaded it last night and in my rush, I didn't record the source--so my apologies to whomever should get the credit.
---------------------------------------
<!-- TWO STEPS TO INSTALL CURRENT DIRECTORY:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Dan Worsham -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var myloc = window.location.href;
var locarray = myloc.split("/");
delete locarray[(locarray.length-1)];
var arraytext = locarray.join("/");
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<form>
<input type=button value="Show Current Directory Listing (Or Index.html Page)" onClick="window.location=arraytext;">
</form>
</center>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 0.90 KB -->
--------------------------------------------------
To see how this works, simply everything between the dotted linesinto a text editor and save as html. It works and will return all files in the same folder as the file.
HTH