Calling other methods directly in Ready will prompt for missing object errors, and the workaround is as follows:
Method 1. The extension of jquery can be used to solve this problem.
$ (document). Ready (function () {
$.extend ({
Show:function () {
Alert ("Ready");
}
});
SetInterval ("Show ()", 3000);
});
Method 2. Do not use quotation marks and parentheses when specifying functions that are timed out.
$ (function () {
Function Show () {
Alert ("Ready");
}
SetInterval (show,3000);//Note the function name does not have quotation marks and brackets!
Use SetInterval ("Show ()", 3000); "Missing objects" will be reported
});
Difference:
SetTimeout ()
To execute an expression or function from a specified time delay after loading;
Execute only once; use with Window.cleartimeout.
SetInterval ()
At execution time, it executes an expression or function from the loading of the page at a specified interval (functionally similar to a recursive function); used with Window.clearinterval.
Using SetInterval and settimeout in jquery prompts for errors with missing objects, and the workaround is as follows: