Click to See Complete Forum and Search --> : How to display images in the current folder and in the drop down box ?


A. J.
09-02-2003, 06:10 AM
Hi,
I need to display the images in the /images/ directory by using jscript to make the files name available in the drop down box, but I could not.
I found this code it was very helpful

============
<html>
<head>
<script language="javascript">
<!--

function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value
}
//-->
</script>
</head>

<body>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><form name="mygallery"><p><select
name="picture" size="1" onChange="showimage()">
<option selected value="me.gif">Picture of me</option>
<option value="myaunt.gif">Picture of my aunt</option>
<option value="brother.gif">Picture of my brother</option>
</select></p>
</form>
</td>
</tr>
<tr>
<td width="100%"><p align="center"><img src="me.gif" name="pictures" width="99"
height="100"></td>
</tr>
</table>


</body>
===========
This code is display speacific images in the drop down box, would you please help me to change it to display all images in the current directory and list the names in the drop down box ??


A. J.

AdamGundry
09-02-2003, 06:39 AM
Javascript cannot get a list of files in the directory. You will need to generate it using server-side code, or hard-code it into the HTML.

Adam

A. J.
09-02-2003, 06:41 AM
Ok,
do you have any other solution please ?? :(

AdamGundry
09-02-2003, 06:42 AM
If you have PHP available on your server, I can write a script to list directory contents using that, or if you have another server-side language others may be able to help.

Adam

A. J.
09-02-2003, 06:47 AM
My web host only support ASP, I'll try to use it. really appreacite your help :)

A. J.
09-02-2003, 10:26 PM
ok ok
I quit please show me how to do it in PHP :(
and I'll try later to change it to ASP

Thanks for your help

pyro
09-02-2003, 10:38 PM
Perhaps you could adapt this: http://forums.webdeveloper.com/showthread.php?s=&threadid=15902&highlight=gallery