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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looping

Status
Not open for further replies.

Zumbro

Technical User
Nov 10, 2001
6
US
Hi,
How do I implement a functionality where something is done over and over while I press the mousedown on for example a button and stop that something on mouseup.

I can't just do a while loop in a function coz that locks the browser completely.. Help please..!
 
Yeah while loops are bad - you can use setInterval, or setTimeout.

setInterval("codeSegment",timeInMilliseconds);

e.g. setInterval("someFunction()",1000);

calls someFunction() every second. Make sure the code segment is a string. If what you want to call has arguments, you will have to make it into strings.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top