Hi all;
i have script below
i would like to ask
why there var step=1; outside the function works but inside not
anyone explain me pls
thanks beforehands
<html><head>
<script type="text/javascript">
<!--
var image1=new Image()
image1.src="bir.jpg"
var image2=new Image()
image2.src="iki.jpg"
var image3=new Image()
image3.src="uc.jpg"
//-->
</script>
</head>
<body>
<img src="bir.jpeg" name="slide" width="100" height="56" />
<script>
<!--
//variable that will increment through the images
function slideit(){
var step=1;
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
slideit()
//-->
</script>
</body>
</html>