This is a discussion on "set and clearInterval with if else" within the JavaScript Forum section. This forum, and the thread "set and clearInterval with if else are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
set and clearInterval with if else
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
set and clearInterval with if else
Can someone please tell me why the clearInterval() func is never called even though the var pl certainly hits 10.
Wierd
|
|
|
|
||||
|
Re: set and clearInterval with if else
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: set and clearInterval with if else
setInterval will run over and over by itself, there is no need to call it repeatedly. It is also good to store the reference to a timeout or interval in a variable.
Try this
This is a timeout so it runs only once. Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
![]() |
| Thread Tools | |
|
|