Jump to content

infinite loop on a timer...


RIRedinPA

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.