Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timer function

Status
Not open for further replies.

kpetursson

Programmer
Joined
Jan 28, 2002
Messages
313
Location
US
Does Javascript contain a timer function.

I want a series of pictures to show on mouse down to give the illusion of animation.

any help would be greatly appriciated!


Kevin Petursson

I have a mind like a steel trap!
Nothing gets in,
Nothing gets out!
Just waiting for it to rust!
 
I found my own anwser. Here it is.

var Timer1;
function setRepeater() {
Timer1 = window.setInterval("functionName()",interval);
return false;
}
function cancelRepeater(timer){
window.clearInterval(timer);
return false;
}

Variables:
Timer1 = named timer. You may have multiple timers running at the same time.
functionName() = the function or action you wish to repeat.
interval = the delay between actions in Milliseconds (1000=1second).
timer = The name of the timer variable (ie. Timer1) you want to cancel.

I hope you find this code usefull.


Kevin Petursson

I have a mind like a steel trap!
Nothing gets in,
Nothing gets out!
Just waiting for it to rust!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top