Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > setTimeout() ig...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 35462 of 36179
Post > Topic >>

setTimeout() ignored in loop

by Steve <stephen.joung@[EMAIL PROTECTED] > May 2, 2008 at 11:35 AM

I have a function called myFunction that can be called once from an
onclick() or 100 times from a function called  loopFunction which
contains a for(var i=0;i<100;i++) loop.

Within myFunction is a setTimeout() function like this:

setTimeout(function(){shuffleDoor()},1500);

Now, when I call myFunction from onclick() it waits 1.5 seconds and
then calls the shuffleDoor function, just as I imagine it should.
However when I call the function from loopFunction it is called 100
times but there is no 1.5 second delay between calls.

Why is this?

Thanks in advance.
 




 7 Posts in Topic:
setTimeout() ignored in loop
Steve <stephen.joung@[  2008-05-02 11:35:53 
Re: setTimeout() ignored in loop
Joost Diepenmaat <joos  2008-05-02 21:14:01 
Re: setTimeout() ignored in loop
Ugo <privacy@[EMAIL PR  2008-05-02 21:29:02 
Re: setTimeout() ignored in loop
Thomas 'PointedEars' Lahn  2008-05-02 22:21:18 
Re: setTimeout() ignored in loop
Steve <stephen.joung@[  2008-05-02 13:02:34 
Re: setTimeout() ignored in loop
Joost Diepenmaat <joos  2008-05-02 22:10:24 
Re: setTimeout() ignored in loop
Gregor Kofler <usenet@  2008-05-03 12:42:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 5 19:43:10 CDT 2008.