I have a great little slide show that I am working on. I just about have
it done, but I have a problem that is driving me nuts!!!
The problem is my "back" button. Once the back button hits the first
image and the user clicks back again, a javascript error occurs (it
states: That my variable is not defined). I know that it is defined
otherwise the back button would not work at all. The "next" button does
not have this problem it will loop continously. I have been researching
others slideshows and a lot of them use seperate html pages or have an
alert appear when the user tries to go past the first image.
Here's the code: Note** imageDB is the array for all the images.
CODE
function next() {
if (boardNum < imageDB.length - 1) boardNum++;
else boardNum = 0;
document.selections.cached.selectedIndex = boardNum
document.thumbnail1.src = imageDB[boardNum].src
boardSpeed=6000;
}
function back() {
if (boardNum < imageDB.length - 1) boardNum--;
else boardNum = 0;
document.selections.cached.selectedIndex = boardNum
document.thumbnail1.src = imageDB[boardNum].src
boardSpeed=6000;
}
// This is the function for rotation of images, call for this in the body<tag> onload
function rotateBoard() {
if (boardNum < imageDB.length - 1) boardNum++;
else boardNum = 0;
document.selections.cached.selectedIndex = boardNum
document.thumbnail1.src = imageDB[boardNum].src
setTimeout('rotateBoard()', boardSpeed);
}
if (boardNum < imageDB.length - 1) boardNum++;
else boardNum = 0;
document.selections.cached.selectedIndex = boardNum
document.thumbnail1.src = imageDB[boardNum].src
boardSpeed=6000;
}
function back() {
if (boardNum < imageDB.length - 1) boardNum--;
else boardNum = 0;
document.selections.cached.selectedIndex = boardNum
document.thumbnail1.src = imageDB[boardNum].src
boardSpeed=6000;
}
// This is the function for rotation of images, call for this in the body<tag> onload
function rotateBoard() {
if (boardNum < imageDB.length - 1) boardNum++;
else boardNum = 0;
document.selections.cached.selectedIndex = boardNum
document.thumbnail1.src = imageDB[boardNum].src
setTimeout('rotateBoard()', boardSpeed);
}
My goal is for the back button to jump back on image 1 and go to the
last image and then continue to count down from there.
I have tried using an if statement, it removed the error but the back
button would only go to the first image and that was it.
Also, would you happen to know of a good reliable tool for compiling
javascript in. A watch/debugger utility, where I can run a script and
watch how it plays out with the variables and functions.
I thank you in advance for any help...


