javascript help

admin

Administrator
Staff member
what am i doing wrong...it won't preload any images inside my for loop...what is the syntax for the preloading thing im trying to do where just the number changes and it loops? Here is the code:
<html>
<head>
<script language="javascript">
var num=1
var pict=1
var picy=60
img1 = new Image ()
img1.src = "aquarium\000_0060.jpg"
for(pict=1; pict<=20; pict=pict+1)
{
"img"+pict = new Image ()
"img"+pict+".src" = "aquarium\000_00"+picy+".jpg"
picy=picy+1
}

function slideshowUp()
{
num=num+1
if (num==5)
{num=1}
document.mypic.src=eval("img"+num+".src")
}

function slideshowBack()
{
num=num-1
if (num==0)
{num=4}
document.mypic.src=eval("img"+num+".src")
}
</script>
</head>
<body>
<IMG SRC=http://www.webdeveloper.com/forum/archive/index.php/"aquarium\000_0060.jpg" NAME="mypic" BORDER=0 height=300 width=300>

<A HREF="JavaScript:slideshowBack()"><img src="left.gif" border="none"></A>

<A HREF="JavaScript:slideshowUp()"><img src="right.gif" border="none"></A>
</body>
</html>
 
Back
Top