Update: My solution does not work in IE. Look at this article for comprehensive info.
Shortly about setTimeout
setTimeout(functionToCall, time, param1, param2, ....);functionToCall is the name of the function which will be called after time millisecond. You either use reference like in the example above or a string representing a call to the function:
setTimeout('functionToCall()', time, ...)The optional parameters can be used to pass any number of parameters to our functionToCall.
Where’s the catch?
setTimeout(this.methodToCall, time);Passing a string representation instead of reference doesn’t work either.
I found the solution after a while searching in Google Code Search. The above example needs to be rewritten like this: