I am trying to get a variable to increment in a function called by setInterval. It does one then stops... All I want is for the slider function to loop through the array over and over again, but it seems to like stopping after the first one. Here is the code:
<script type='text/javascript'>
var i = 0;
function slider(varToSlide)
{
document.write(varToSlide[i]);
i++;
if(i == 2) { i = 0; }
}
var slides = new Array;
slides[0] = "0";
slides[1] = "1";
slides[2] = "2";
setInterval("slider(slides)", 1000);
</script>