Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

Slideshow


< html >
< head >
< script >
<!-- Original :  D. Keith Higgs (dkh2@po.cwru.edu) -->
<!-- Begin
var timeDelay = 5; // change delay time in seconds
var Pix = new Array
( "toad.jpg"
, "chameleon.jpg"
, "lizard.jpg"
, "gecko.jpg"
);
var howMany = Pix.length;
timeDelay *= 1000;
var PicCurrentNum = 0;
var PicCurrent = new Image();
PicCurrent.src = Pix[PicCurrentNum];
function startPix() {
setInterval( "slideshow()" , timeDelay);
}
function slideshow() {
PicCurrentNum ++ ;
if (PicCurrentNum == howMany) {
PicCurrentNum = 0;
}
PicCurrent.src = Pix[PicCurrentNum];
document[ "ChangingPix" ].src = PicCurrent.src;
}
//  End -->
</ script >

</ head >

< body Background = .. / graphics / grayback.jpg OnLoad = "startPix()" >
< center >< BR >< BR >
< img name = "ChangingPix" src = "toad.jpg" >


</ center >
</ BODY >

</ html >

//Thanks to David Pye for his JavaScript Vault contribution.