RIRedinPA Posted September 8, 2010 Share Posted September 8, 2010 what am i doing wrong here, it only loops once. <script language="javascript"> var i=0; $(document).ready(function(){ startFadeLoop(); }); function startFadeLoop() { i++; alert(i); if(i==1) { var lastitem = 1; var nextitem = 2; } else if (i == 2) { var lastitem = 2; var nextitem = 3; } else if (i == 3) { i=0; var lastitem = 3; var nextitem = 1; } document.write(i + "<br>"); setTimeout("startFadeLoop()", 1000); } </script> Link to comment https://forums.phpfreaks.com/topic/212863-infinite-loop-on-a-timer/ Share on other sites More sharing options...
KevinM1 Posted September 8, 2010 Share Posted September 8, 2010 Try setInterval() Link to comment https://forums.phpfreaks.com/topic/212863-infinite-loop-on-a-timer/#findComment-1108695 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.