Tutorials - JavaScript: Image slide show
Adding a JavaScript slide show to a page is a nice interactive way to display pictures or provide a picture tour of a campus. Below is the JavaScript and HTML to incorporate such an element into your Web page. You can also view the Sacramento State picture tour. Keep in mind that all the images used in your slide show should be the same size.
Step 1
Copy the JavaScript from the box
below and paste it into the <head> section
of your HTML document.
Step 2
Change the references to the images to match your image file names and directory structure. Here is the text from above, now in bold, that you need to change.
var imagePath = "images/";
pictures = new Array("picture.jpg", "picture2.jpg", "picture3.jpg", "picture4.jpg","picture5.jpg");
viewedPics = new Array();
Step 3
Copy the JavaScript from the box below and paste
it into the <body> section of your HTML
document where you want to place the image slide
show.
Step 4
Change the reference to the folder and file where your first image is located, and the alternate text to appear in the browser. Here is the text from above, now in bold, that you need to change.
<a name="slideshow"></a>
<a onmouseover="window.status='Click to view CSUS'; return true" onclick="pickOne()" onmouseout="window.status=''; return true" href="#slideshow">
<img src="images/picture.jpg" alt="Click here to view the sample CSUS slideshow" name="SlideShow" width="285" height="162" border="0" id="SlideShow" /></a>
Example
last reviewed: January 25, 2008

