One of hundreds of answers available with our premium content service.
A: The most important thing about using timeouts is to create a global variable, a “handle”, by which you can clear the timeout if you need to. The example below defines two functions delayAction() that sets the timeout to execute in 500 milliseconds and cancelAction() which aborts the action. The script inserts two action buttons into the page to trigger these function calls.
… full answer hidden
Premium members click below for full answer
How should I write a script using timeouts?
We love social media, but we do not expect you to create yet another public outpost on the Web.