Posts Tagged ‘settimeout’
Pass arguments through to your JavaScript functions from setTimeout() (revisited)
There are times when I review posts that I have written from the past, and I wonder who it was who wrote what they did, and at what point did the body snatcher leave my body. On September 24, 2006, I wrote Pass parameters to your JavaScript functions correctly from setTimeout() using OOP, which was one such post. I am revisiting that tutorial here with a more intuitive example — sans body snatcher.
Pass parameters to your JavaScript functions correctly from setTimeout() using OOP
08/11/08 Update:
This post was revisited with a more intuitive example. Please visit Pass arguments through to your JavaScript functions from setTimeout() (revisited)
If you are moving beyond using JavaScript for simple tasks, and are building full fledged Web applications, then you will likely make heavy use of the setTimeout() method available to the window object. This timer can be powerful, but it also possesses a single shortcoming that stumps even experienced programmers. There is no “built-in” mechanism within setTimeout() for calling a function that needs parameters passed to it.

