Click to See Complete Forum and Search --> : Image Flip when clicked...


kevmoon
10-30-2005, 10:28 AM
Hi I'm fairly new to html and javascript but any help would be greatly appreciated...

I'm wondering how to create an image flip when the image is clicked rather that by just by passing over it with the mouse...

I know this is probably very simple but I'm extremely frustrated...!!

Help?? :confused:

LiLcRaZyFuZzY
10-30-2005, 11:34 AM
what do you mean by image flip?

kevmoon
11-04-2005, 12:34 PM
By an image flip I mean that when you click on the image, it changes to another image. Like a "mouse over image flip" except with a click...?

TheBearMay
11-04-2005, 01:03 PM
Just need to use the onclick event:


var imgArr=["img1.jpg", "img2.jpg", ....];
var arrInx=-1;

function newImage(){
arrInx++;
if (arrInx >= imgArr.length) arrInx = 0;
document.getElementById("imgRotate").src=imgArr[arrInx];
}

....

<img src="img999.jpg" onclick="newImage();" id="imgRotate" />