Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>View Images in a Directory Script...?

View Images in a Directory Script...?

tdfsu
11-24-2004, 08:34 PM
Is there a script that will list images that are in a directory, and then open the image (*.jpg) within IE when clicked on. This will prevent the manual html coding of each image, so that new images can just be added to the directory without having to "hard" code them in.

Does that make sense?

Thanks a bunch,
Jason.

codegoboom
11-24-2004, 11:02 PM
It can be done from a local HTML Application, or configuration script, if that's where your directory is. Otherwise, it would probably require server-side scripting.

gaBRiel
11-24-2004, 11:46 PM
if the images are in the same directory as the html page(as codegoboom said), you can name the images with names like:'image1, image2, image3' or 'pic1, pic2, pic3,etc' and do this:


<script>
i=0
img_width=1
var pics=new Array()
while(img_width>0){
var pics[i]=new Image()
pics[i].src=http://www.codingforums.com/archive/index.php/"pics"+i+".jpg"
if(pics[i].width=0){
img_width=0
}
}
</script>

this (hopefully) should call the images in your folder and store them in a array, if the image exists, its width will be greater than 0, so it will continue the loop and store images. If it summons an image that doesnīt exist, this imageīs width will be 0, and it will stop the loop.

then to call the images:

<body>
<script>
i2=0
while(i2<i){
document.write("<a href='pics"+i2+".jpg'>image"+i2+"</a>")
i2++
}
</script>


hope thatīs what you wanted and hope that works.

codegoboom
11-25-2004, 01:20 AM
Ah, that sounds feasible. :)


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

A little help with javascript IF/THEN
help me to resolve this checkbox problem
Is VBScript "invisible"?
does anyone use Venkman?
How can I use "enter" to submit a form in a frame using javascript?
So confused
working with a java applet

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics