If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Switching images using JavaScript

I'm currently learning JavaScript at a university level (so still pretty basic level teachings) but I'm stumped on how to perform this request.

Basically I have two images (one is a tiny blue ball and one is a tiny red ball) and a button "Change Color". They start out one Red and one Blue.

I have to design it so it's changing the color of the balls. Starting with the color combination of two balls(blue,blue), any button click must lead to the following color combinations repeated cyclically: (blue,red), (red,blue), (red,red), then again (blue,blue)...

Both balls have their own image file as well. I have the basic structure down to just switch between Red and blue over and over but I'm stumped at this point...any suggestions?

(joke).. Who's going to read the code?... Id cheat and make a 4 frames slideshow with a next button.. DONE!

(real).. I understand.. You want a js that adjusts 2 images from 1 button... Theres a ton of scripts around to do that..

My point is.. I would take the 1 button 2 image script & the slide show script.. and blend to make this script!...

Thats what I would do and Id get it working... just suggesting outside the box, no biggy

To be honest, this course has been using teachings relevant from around 2003 so I'm not really learning good habits. So I'm not against this suggestion to be honest haha. To be honest though, I'm not 100% sure how to blend this current slideshow script either.