Connecting Tech Pros Worldwide Help | Site Map

Slideshow? Well sort of...

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 16th, 2006, 10:35 PM
Andrew Bailey
Guest
 
Posts: n/a
Default 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



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.