scoe
10-19-2003, 10:38 PM
hi there
i've got a code that is meant to cycle some images every 2 seconds.
however the code doesn;t work. the error i get is that the array is not defined and currentad is not defined.
here is my code:
<html>
<head>
<script type="text/javascript">
#theimages=new array("aminorforest.jpg", "flypanam.jpg", "mogwai.jpg");#
currentad=0;
numad=3;
function cycle() {
if (document.images) {
#currentad++;#
if (currentad==numad) {
currentad=0;
}
document.adimage.src=theimages[currentad];
setttimeout("cycle()", 2000);
}
}
</script>
<title></title>
</head>
<body onload="cycle()">
<img src="aminorforest.jpg" name="adimage">
</body>
</html>
the lines between the hashes are the lines with the error.
does anyone know how to get fix these errors??
thanks
i've got a code that is meant to cycle some images every 2 seconds.
however the code doesn;t work. the error i get is that the array is not defined and currentad is not defined.
here is my code:
<html>
<head>
<script type="text/javascript">
#theimages=new array("aminorforest.jpg", "flypanam.jpg", "mogwai.jpg");#
currentad=0;
numad=3;
function cycle() {
if (document.images) {
#currentad++;#
if (currentad==numad) {
currentad=0;
}
document.adimage.src=theimages[currentad];
setttimeout("cycle()", 2000);
}
}
</script>
<title></title>
</head>
<body onload="cycle()">
<img src="aminorforest.jpg" name="adimage">
</body>
</html>
the lines between the hashes are the lines with the error.
does anyone know how to get fix these errors??
thanks