PDA

View Full Version : Novice coder needs small question answered.


glockmodel23
01-07-2003, 01:18 AM
I recently grabbed a code from http://www.javascriptkit.com/script/script2/incrementslide.shtml

I know nothing about code. I am an amateur web designer. I am making a site for a friend and would like to use the slideshow to change pictures. I do not know how to edit the code to select the pictures I want to show.

How do I edit the code to pick a directory of photos?
How do I edit the code to pick a URL to display them?

I appreciate any help on this matter.

Terry
01-07-2003, 02:32 AM
In your code you have an array of images:


//set image paths
src = ["image1.gif",
"image2.gif",
"image3.gif",
"image4.gif"]


Change them to reflect the path on your server. The array is a comma separated "list" of the paths and names of your images. If you have a directory called images, then just reflect that in the array:


//set image paths
src = ["images/image1.gif",
"images/image2.gif",
"images/image3.gif",
"images/image4.gif"]


You can add as many as you want, just follow the syntax. The way it is now you have 4 indexes. src[0] is "images/image1.gif", src[1] is "images/image2.gif" etc.

The other array is for the location you wish to take the user when he clicks the images. The 2 arrays correspond to each other respectively.


//set corresponding urls
url = ["http://freewarejava.com",
"http://javascriptkit.com",
"http://dynamicdrive.com",
"http://www.geocities.com"]


So when the user sees src[0], which would be "images/image1.gif", then if he clicked the image he would be taken to the location which is specified in url[0], which is "http://freewarejava.com" - but could be any url you want.

Hope this helps.

- Terry