Click to See Complete Forum and Search --> : getting slideshow to autorun on page load


csli820
08-18-2003, 12:22 AM
Trying to make a slide show autorun when page loads without clicking on start button. Tried <body onload="roatate ()" > but it doesn't work. Here's the code I am using.


<!-- Begin slide show control menu
var rotate_delay = 5000; // delay in milliseconds (5000 = 5 secs)
current = 0;
function next() {
if (document.slideform.slide[current+1]) {
document.images.show.src = document.slideform.slide[current+1].value;
document.slideform.slide.selectedIndex = ++current;
}
else first();
}
function previous() {
if (current-1 >= 0) {
document.images.show.src = document.slideform.slide[current-1].value;
document.slideform.slide.selectedIndex = --current;
}
else last();
}
function first() {
current = 0;
document.images.show.src = document.slideform.slide[0].value;
document.slideform.slide.selectedIndex = 0;
}
function last() {
current = document.slideform.slide.length-1;
document.images.show.src = document.slideform.slide[current].value;
document.slideform.slide.selectedIndex = current;
}
function ap(text) {
document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
rotate();
}
function change() {
current = document.slideform.slide.selectedIndex;
document.images.show.src = document.slideform.slide[current].value;
}
function rotate() {
if (document.slideform.slidebutton.value == "Stop") {
current = (current == document.slideform.slide.length-1) ? 0 : current+1;
document.images.show.src = document.slideform.slide[current].value;
document.slideform.slide.selectedIndex = current;
window.setTimeout("rotate()", rotate_delay);
}
}
// End -->

csli820
08-18-2003, 12:24 AM
typo in request for help. i meant i tried <body onload"rotate()"> and it doesn't work.

Khalid Ali
08-18-2003, 10:28 AM
this should make this app run

onload="rotate();">

however if does not do what its meant to,then please post the error you get or post a link whre you have this imlemented.

csli820
08-18-2003, 11:24 AM
i tried the suggestion but the slide show still doesn't autorun onload. here's where the page is:

http://www.sharpinsightsconsulting.com/slide/index3.html

please advise.

Khalid Ali
08-18-2003, 12:14 PM
There are some logical flow problems,I am sure you will find them and fix them,your current problem is this

use the following onload event structure

<body onload="ap('Start');rotate();">

csli820
08-18-2003, 01:22 PM
Thanks. I will fix fix the flow of the rotate.

Kudos to you. :)

Khalid Ali
08-18-2003, 01:27 PM
you are welcome..:D