HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 26th, 1999, 11:19 AM
Cherie
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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> 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...
Cherie

Reply With Quote
  #2  
Old May 27th, 1999, 10:08 AM
giorgios
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Try using the onUnload object for when leaving a document. Make it write boardnum to a variable called back(or something similar).
Have function back call on this variable instead.
This method will only go back once unless you can figure out some way to use an array to create a history.

Sorry I can't give you more details but I'm a beginner still.

I hope I've been of some help.

------------------
If our time is up, what is down?

Reply With Quote
  #3  
Old May 27th, 1999, 10:47 AM
Cherie
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Thank you for your response.

I am using an array to control the images that swap. It is imageDB. Then boardNum (which calls to the same array imageDB) is used to control the back and next buttons in a function.

I have researched the web looking for slideshows that swap images(not pages) in the same page and have next and back buttons, I noticed that none of them let you go back past the first image. I know I am not alone in this quest...

Reply With Quote
  #4  
Old May 27th, 1999, 04:49 PM
tkessler
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
The if statment in your back function that looks like this:

if (boardNum < imageDB.length - 1)
boardNum--;
else
boardNum = 0;


Should probably look like this

if (boardNum > 0)
boardNum--;
else
boardNum = imageDB.length-1;


The first version would allow the boardNum to become negative, causing an error, the second one will return the boardNum index to the end of the array.


Reply With Quote
  #5  
Old May 27th, 1999, 05:44 PM
Cherie
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
tkessler,

Hat's off to you!!!

Thank you so much! I hope someday,somehow I will be able to return the favor.

Thank's again,
Cherie

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Baffled


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway