Click to See Complete Forum and Search --> : redisplay image that was randomly chosen


alvar
08-17-2003, 07:19 PM
this is killing me!

i have an image that is chosen randomly,
that is also used to display other images on mousing over a link. My question is, does anyone know how to get back the random image that was originally displayed?

function displayRandom()
{
var img_name = new Array("images/random/1.jpg", "images/random/2.jpg",
"images/random/3.jpg", "images/random/4.jpg")

var l = img_name.length;

var rnd_no = Math.round((l-1)*Math.random());

document.thumb.src = img_name[rnd_no];


}

Ice3T
08-17-2003, 07:36 PM
I think this was already answered here:
link (http://forums.webdeveloper.com/showthread.php?s=&threadid=15559)

Ice3T
08-17-2003, 07:43 PM
I'm sorry I meant here (http://forums.webdeveloper.com/showthread.php?s=&threadid=15563)

alvar
08-17-2003, 07:48 PM
the original image is random,
not the mouseover

dont see how i can use it
though, am i wrong?

i am a begginner in JS. . .

thanx

alvar
08-21-2003, 08:07 AM
this is actually what i was looking for (myvar):

myvar = img_name[rnd_no];
document.thumb.src = img_name[rnd_no];