I am trying to cycle through an array slowly, but my code seems to execute then jump to the last value in the array. Why is that ?
Code:
<script language="JavaScript" type="text/javascript">
<!--
window.onload= fade;
var i;
var ids = new Array("one", "two", "three");
function fade()
{
for (i=0 ; i<3; i++)
document.getElementsByTagName("div")[0].id=ids[i]
setTimeout("fade()", 500);
}
//-->
</script>