PDA

View Full Version : Trying to tweak Preloaded Slide Show Script by Jason Moon...



ovoman
09-20-2011, 06:34 PM
http://www.dynamicdrive.com/dynamicindex14/preloadslide.htm


Hi everybody,

I'm trying to tweak this "Preloaded Slide Show Script" to do the following actions:

1. autoplay when the page is loaded
2. prompt to another .htm page when the slideshow is over.

Can anybody help?

Thanks!

Here's the script of the slideshow i'm working on:




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Aquaovo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../../../CSS/CSS001.css" rel="stylesheet" type="text/css">
<script language="JavaScript">

//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('/alterego/slides/fr/alterego-slide-01.jpg','/alterego/slides/fr/alterego-slide-02.jpg','/alterego/slides/fr/alterego-slide-03.jpg','/alterego/slides/fr/alterego-slide-04.jpg','/alterego/slides/fr/alterego-slide-05.jpg','/alterego/slides/fr/alterego-slide-06.jpg','/alterego/slides/fr/alterego-slide-07.jpg','/alterego/slides/fr/alterego-slide-08.jpg','/alterego/slides/fr/alterego-slide-09.jpg','/alterego/slides/fr/alterego-slide-10.jpg','/alterego/slides/fr/alterego-slide-11.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);
}
</script>
</head>

<body onLoad="StartSlideShow()">

<form name="SlideShow">
<table>
<tr>
<td colspan=2><img name="Screen" width=700 height=404></td>
</tr>
<tr>
<td><input type="button" name="Previous"
value="*<<*"
onClick="ShowSlide(-1)"></td>
<td align="right"><input type="button" name="Next"
value="*>>*" onClick="ShowSlide(1)"></td>
</table>
</form>

</body>
</html>