Using the SetTimeout() Function

Using the SetTimeout() Function

Browsers Targeted: Internet Explorer 3+, Netscape 3 and 4

Sometimes, you need to set up events to happen at periodic intervals. Perhaps the simplest application of this is a clock. While both JavaScript and VBScript have time functions (through the Date object), a clock requires that you update this time regularly. As there is no periodic event that you can automatically query thrown by the document, one way of updating such a clock would be to use the SetTimeout() function. Taking the three arguments of an expression to call (as a string), the number of milliseconds to wait and an optional language specifier for interpreting the expression (the default value for this is “JavaScript”), the setTimeout function returns a numeric id that identifies the timeout. Then, after the requested interval, the expression is called in the specified language.

You can kill a timeout by passing the ID of the timeout to the function clearTimeout(). This is especially useful for making sure that the system doesn’t attempt to call a setTimeout function on a different page after you’ve left the original page.

0:00:00
 

 
0:00:00

 
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several