Your question doesn’t give much details to help you.
But here are some links for javascript timers.
http://javascriptweblog.wordpress.com/2010/06/28/understanding-javascript-timers/
http://ejohn.org/blog/how-javascript-timers-work/
You may have a play/pause button. And trigger functions on pressing that button.
Try something using this information, when stuck in some problem, post what you tried, and people will help you.
solved Javascript time spent playing [closed]