Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Javascript Back , Forward Or Next Buttons Issue

Recommended Posts

Okay webmasters, please put your wizard hats on and work your magic.

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.

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> onloadfunction rotateBoard() {if (boardNum < imageDB.length - 1) boardNum++;else boardNum = 0;document.selections.cached.selectedIndex = boardNumdocument.thumbnail1.src = imageDB[boardNum].srcsetTimeout('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...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.