HOME       >>       Programming

Javascript Help Cant do simple variable functions ?_?


Dagoth Nereviar

Edit: Haha, nevermind....I've had it fixed now 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?

BuffaloHelp

It would have been nice to know how you fixed it. Topic closed.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.