Log In · Register

 
 
Closed TopicStart new topic
Random images slideshow not looping
suebriquet
post Dec 13 2007, 12:20 AM
Post #1


Member
**

Group: Member
Posts: 23
Joined: Sep 2007
Member No: 577,463



Hello,
I created an html page that contains css, javascript and html. I'm using this page as my desktop currently. It's a slideshow of some of my desktop images so that my desktop can change pictures after about 10 seconds. It's supposed to loop so that random images keep appearing, but somehow it's not looping and it stops after a while. Here's my code. I hope someone can help.
CODE
<html>
<head>
<style type="text/css">
body {
padding: 0px;
margin: 0px;
overflow-x: hidden;
overflow-y: hidden;
}
</style>

<script>
// ==============================
// Set the following variables...
// ==============================

var SlideShowSpeed = 10000; // Set the slideshow speed (in milliseconds)
var CrossFadeDuration = 5; // Set the duration of crossfade (in seconds)
var imageArray = new Array(); // don't change this
var imageDir = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/";
imageArray[1] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/1.jpg";
imageArray[2] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/2.jpg";
imageArray[3] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/3.jpg";
imageArray[4] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/4.jpg";
imageArray[5] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/5.jpg";
imageArray[6] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/6.jpg";
imageArray[7] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/7.jpg";
imageArray[8] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/8.jpg";
imageArray[9] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/9.jpg";
imageArray[10] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/10.jpg";
imageArray[11] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/11.jpg";
imageArray[12] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/12.jpg";
imageArray[13] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/13.jpg";
imageArray[14] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/14.jpg";
imageArray[15] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/15.jpg";
imageArray[16] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/16.jpg";
imageArray[17] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/17.jpg";
imageArray[18] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/18.jpg";
imageArray[19] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/19.jpg";
imageArray[20] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/20.jpg";
imageArray[21] = "file:///C:/Documents and Settings/Sue/My Documents/My Pictures/desktop/21.jpg";
// =====================================
// Do not edit anything below this line!
// =====================================

var t;
var i;
var p = imageArray.length-1;

var preLoad = new Array();
for (i = 1; i < p+1; i++){
preLoad[i] = new Image();
preLoad[i].src = imageArray[i];
}

function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=2)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();
}
var whichImage = Math.round(Math.random()*(p-1));
document.images.PictureBox.src = preLoad[whichImage].src;
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
whichImage = whichImage + 1;
if (whichImage > (p)) whichImage=1;
this.repeat = true;
t = setTimeout('runSlideShow()', SlideShowSpeed);
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+imageArray[whichImage]+'" name="PictureBox">');
}
</script>
</head>
<body onload="runSlideShow()">
<script>
showImage();
</script>
</body>
</html>


My theory is the thing that's having issues is in the runSlideShow() function. Thanks in advance!
 

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: