Skip to main content
June 20, 2008
Question

A Timer I think

  • June 20, 2008
  • 2 replies
  • 275 views
Hey everyone
I am trying to get a function to run only once and then stop at 5 seconds. I can get it to perform the function fine at 5 seconds but then 5 seconds later it runs again but only performs half the functions. I am not sure if it is an error in my timer script or an error in my function script. Here it is please help me if you can.
Thanks


This topic has been closed for replies.

2 replies

June 20, 2008
Thanks a ton Rob! works perfectly.
robdillon
Participating Frequently
June 20, 2008
Just add:

clearInterval(intervalId); at the end of the function.

That will turn off the interval and the function will only run once.