...

View Full Version : Image Help Quick



unknwon12
12-24-2003, 09:18 AM
i have this script (below) and was wondering what would i add to that to make the images display random?

Code:


<html>
<head>
<script language="JavaScript1.1">
<!--
//preload images
var image1=new Image()
image1.src="firstcar.gif"
var image2=new Image()
image2.src="secondcar"
var image3=new Image()
image3.src="thirdcar.gif"
//-->
</script>
</head>
<body>
<a href="java_script_:slidelink()"><img src="firstcar.gif" name="slide" border=0 width=100 height=56></a>
<script>
<!--
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<3)
step++
else
step=1
setTimeout("slideit()",1800)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="link1.htm"
else if (whichimage==2)
window.location="link2.htm"
else if (whichimage==3)
window.location="link3.htm"
}
//-->
</script>
</body>
</html>

unknwon12
12-24-2003, 06:31 PM
please?

Philip M
12-24-2003, 06:58 PM
Here's a link which should help you:-

http://www.codingforums.com/showthread.php?s=&threadid=24434&highlight=random+image

Bear in mind that you probably do not want your
image selection truly random as in that case
the same image can be randomly selected twice
and thus repeat.

unknwon12
12-24-2003, 07:01 PM
thanks!
is therw anyway to make each i mage have a link like in my script? and i would like to know how to modify mine to be random.

Philip M
12-24-2003, 07:05 PM
If you search the threads in this forum you will find several
which cover your question.

unknwon12
12-24-2003, 07:12 PM
Sorry - no matches. Please try some different terms.

Philip M
12-24-2003, 07:15 PM
Funny. I searched for

random image

and got 65 threads.

unknwon12
12-24-2003, 07:25 PM
i want a random rotator

Skyzyx
12-24-2003, 07:42 PM
Give it a little more effort. We're here to assist, not to do this for you. Nobody here is paid, so nobody is required to do anything. We're willing to help you, but you need to be willing to help yourself as well.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum