I created an array and inserted a setInterval in it, but tmp[0] doesn’t work
tmp = new Array();
v = new Array();
for(i=0; i<2; i++){
j = 0;
tmp[i] = setInterval("if(j<10+(i*5)){alert(i+' '+j);j++;}else{clearInterval(tmp[i])}", 1000);
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do Not use eval. Try this:
Fiddle: http://jsfiddle.net/FKEL6/ (it is annoying with the popups, just so you are aware.)
This might do what you want it to do:
Fiddle: http://jsfiddle.net/FKEL6/5/ (also has annoying alerts)