Top 3 Products & Services
Dated: Sep. 11, 2005
Related CategoriesDHTML (Dynamic HTML)
Animation Techniques in DHTML
setTimeout, setInterval, clearTimeout, clearInterval
These four methods are all window methods, and provide a solid backbone for most animation techniques in DHTML.
They can also be grouped as:
These two pairs are very similar, but there is one significant difference. With both pairs, we tell the script to call a specified function after a specified amount of time. With Timeout, this only occurs once, with Interval this occurs periodically.
Obviously, we may only wish a function to be called periodically for a while, and then we wish to do something else, and we use the clearInterval method to stop any programmed setInterval methods.
setTimeout is often used for animating objects - we could use setInterval, but setInterval is less easy to control.
Now that you've gotten free know-how on this topic, try to grow your skills even faster with online video training. Then finally, put these skills to the test and make a name for yourself by offering these skills to others by becoming a freelancer. There are literally 2000+ new projects that are posted every single freakin' day, no lie!