Slideshow? Well sort of...
Hi,
I need to create a variation of a slideshow but instead of images I will be
using documents.
So in the head I define my array like so...
SLIDE = new Array()
SLIDE[0]="page1"
SLIDE[1]="page2"
SLIDE[2]="page3"
SLIDE[3]="page4"
SLIDE[4]="page5"
then I start a loop that displays the first page for 10 seconds, then each
consecutive page for 5 seconds before looping back to page1...
CURRENTSLIDE=0
startslideshow=1
var slidedelay
function slideshow(){
if (startslideshow==1){
if (CURRENTSLIDE<=SLIDE.length-2){
if (CURRENTSLIDE<=0){
CURRENTSLIDE=0
slidedelay=setTimeout("display(SLIDE[CURRENTSLIDE]); slideshow();",
"10000")
CURRENTSLIDE++
} else {
slidedelay=setTimeout("display(SLIDE[CURRENTSLIDE]); slideshow();",
"5000")
CURRENTSLIDE++
}
} else {
slidedelay=setTimeout("display(SLIDE[CURRENTSLIDE]);", "5000")
CURRENTSLIDE=0
slidedelay=setTimeout("slideshow();", "5000")
}
} else {
clearTimeout(slidedelay)
}
}
function stopslideshow(){
clearTimeout(slidedelay)
startslideshow=0
}
function restartslideshow(){
startslideshow=1
CURRENTSLIDE=CURRENTSLIDE-2
slideshow()
}
The above loop works fine, what I'm having trouble with is the event that is
triggered by the loop...
This bit...
display(SLIDE[CURRENTSLIDE]);
I'm not very good at java, but my understanding is that the above snippet
would call a function called "display" and pass the array string "page1" in
the brackets as if you had triggered display(page1)... right?
IF I've got that bit right then the function display needs to do something
like this...
NON-WORKING-PIGEON-JAVA-EXAMPLE
function display(thispage){
thispage.style.display="inline";
}
That example doesn't work (which is why I need your help) but I also need to
expand on this so not only does it display the right <spanbut also hides
all the others like this...
NON-WORKING-PIGEON-JAVA-EXAMPLE
function display(thispage){
for (currentpage=0;currentpage<count(SLIDE);currentpag e++){
if (currentpage==thispage){
currentpage.style.display="inline";
} else {
currentpage.style.display="none";
}
}
}
Each page is encapsulated by <span id="pageX" style="display:
hidden"></span>
Thanks for looking and super-dooper-thanks™ if you can help
Andy |