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 > Re: setTimeout(...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 7 Topic 35462 of 37137
Post > Topic >>

Re: setTimeout() ignored in loop

by Joost Diepenmaat <joost@[EMAIL PROTECTED] > May 2, 2008 at 09:14 PM

Steve <stephen.joung@[EMAIL PROTECTED]
> writes:

> 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?

Because you're doing it wrong. Your error is at line 15.

Whenever you suspect a bug in a javascript/host implementation (or any
other system that people have been using for years), it's your job to
show that the bug is really there. Since you haven't done that, I'm
going to assume the bug is really in your own code. Show the actual
code, and we can probably find the actual problem.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/
| work: http://zeekat.nl/
 




 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 Oct 11 16:20:24 CDT 2008.