PDA

View Full Version : DHTML Javascript Slideshow author Jason moon



ztaste
05-21-2006, 06:32 AM
I put this script up a while ago than wanted to add stuff do the page and I accidentally deleted it. I put this script up this weeken and some reason on the # 3 image the slideshow buttons freezes up. Here is a outline of my source code. You may view at http://ztaste.com/Lew/church.html Thanks



//Preloaded slideshow script- By Jason Moon
//For this script and more
//Visit http://www.dynamicdrive.com

// PUT THE URL'S OF YOUR IMAGES INTO THIS ARRAY...
var Slides = new Array('church1.JPG','church2.JPG', 'church3.JPG','church4.JPG', 'church5.JPG', 'church6.JPG','church7.JPG','church8.JPG','church9.JPG');

// DO NOT EDIT BELOW THIS LINE!
function CacheImage(ImageSource) { // TURNS THE STRING INTO AN IMAGE OBJECT
var ImageObject = new Image();
ImageObject.src = ImageSource;
return ImageObject;
}

function ShowSlide(Direction) {
if (SlideReady) {
NextSlide = CurrentSlide + Direction;
// THIS WILL DISABLE THE BUTTONS (IE-ONLY)
document.SlideShow.Previous.disabled = (NextSlide == 0);
document.SlideShow.Next.disabled = (NextSlide ==
(Slides.length-1));
if ((NextSlide >= 0) && (NextSlide < Slides.length)) {
document.images['Screen'].src = Slides[NextSlide].src;
CurrentSlide = NextSlide++;
Message = 'Picture ' + (CurrentSlide+1) + ' of ' +
Slides.length;
self.defaultStatus = Message;
if (Direction == 1) CacheNextSlide();
}
return true;
}
}

function Download() {
if (Slides[NextSlide].complete) {
SlideReady = true;
self.defaultStatus = Message;
}
else setTimeout("Download()", 100); // CHECKS DOWNLOAD STATUS EVERY 100 MS
return true;
}

function CacheNextSlide() {
if ((NextSlide < Slides.length) && (typeof Slides[NextSlide] ==
'string'))
{ // ONLY CACHES THE IMAGES ONCE
SlideReady = false;
self.defaultStatus = 'Downloading next picture...';
Slides[NextSlide] = CacheImage(Slides[NextSlide]);
Download();
}
return true;
}

function StartSlideShow() {
CurrentSlide = -1;
Slides[0] = CacheImage(Slides[0]);
SlideReady = true;
ShowSlide(1);
}

jscheuer1
05-21-2006, 09:45 PM
Looks like those images are just missing, no locking up is occurring, you can still go backward and the status is updated in both directions.

ztaste
05-22-2006, 09:46 AM
Thanks I Change Names To FILES Photo1.JPG , Photo2.jJPG Etc And They Work Because I Uploaded Church1.JPG And So Fourth In Ipswitch Wsftp And Deleted Them Back And Fourth. I Guess The Files Were Corrupt And Im Glad This Work I Can Get Some Sleep Thanks Again.