This article illustrates the way that JavaScript implements code-passing parameters to settimeout. Share to everyone for your reference. The specific analysis is as follows:
The SetTimeout function is the most critical function for implementing dynamic effects in JavaScript. But yesterday when I wrote the code, I found that when the first argument is a function call, you cannot pass arguments to the called function. This is really a very serious problem, I have been troubleshooting for a long time to find the problem, waste more than n times ah.
Later on the Internet to check, this is actually a bug in IE. There are many solutions, of which I think the most cow is to rewrite the settimeout function ... This is too much trouble. A very simple method is recommended here. Just add the function{} keyword to the function you want to call.
function ShowMsg (x,y)
{
}
settimeout (Funtion () {showmsg (x,y)},1000);
This makes it easy to solve the problem of not being able to pass the parameter.
I hope this article will help you with your JavaScript programming.