Jump to content
xisto Community
Sign in to follow this  
Dagoth Nereviar

Javascript Help Cant do simple variable functions ?_?

Recommended Posts

Edit: Haha, nevermind....I've had it fixed now :P an admin/mod can delete this if s/he feels like it :)



Slide show

So i'm trying to make my own slideshow, see above. I have the pictures showing depending what "num" equals...Well, the code's here:

<script TYPE="text/javascript"><!--var num = 1;var pic = "pic.gif";switch (num){default:document.write("<img src='pic1.gif'>");break;case 1:document.write("<img src='pic1.gif'>");break;case 2:document.write("<img src='pic2.gif'>");break;case 3:document.write("<img src='pic3.gif'>");break;}function next(){num ++;alert("Done!");}--></SCRIPT><br><script TYPE="text/javascript"><!--document.write(num)--></SCRIPT><br><br><form><input type="button" onclick="next()" value="Next"></form>

(That's all in the body section, btw.)

But when I click "Next", the alert comes up, but num doesn't increase....I've tried using "num + 1" "num = num + 1" "num += 1" etc, etc, etc, but none of them work.

So my question is...How can I get it to work?
Edited by Dagoth Nereviar (see edit history)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
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.