Evaluates a expression after a specified number of milliseconds has elapsed.
(executes the specified expression after the specified time)
Syntax:itimerid = Window.settimeout (Vcode, Imilliseconds [, Slanguage])
Parameters
Vcode |
Required. Variant that specifies the function pointer or string This indicates the code to is executed when the specified interval h As elapsed. |
Imilliseconds |
Required. Integer that specifies the number of milliseconds. |
Slanguage |
Optional. String that specifies one of the following values:
Jscript |
Language is JScript. |
VBScript |
Language is VBScript. |
Javascript |
Language is JavaScript. |
|
Return Value
Integer. Returns An identifier this cancels the evaluation with the Cleartimeout method.
==============================================================
-------------------------------------------------------------------
settimeout (Alert ("3 seconds Passed"), 3000);//Call a function that allows constant arguments
-------------------------------------------------------------------
<mce:script language= "Javascript" ><!--//by zuoyang var x = 1; var y = 2; var z = 3; var sum; function Plus (A, b) {var z = 0; var i = 0; for (i = 0; i < arguments.length; i++) {z = = Arguments[i];} settimeout (f Unction () {alert (z);}, 6000); Can return z with variable parameter settimeout call form; } settimeout (function () {sum = Plus (x, y, z);}, 3000);///////--></mce:script> In addition to the settimeout invocation form that can be used with variable parameters to get the return value.
The use of SetInterval () is the same as settimeout ():
Itimerid = Window.setinterval (Vcode, Imilliseconds [, Slanguage])
The difference is that settimeout () is a one-time action, and SetInterval () performs a vcode every imilliseconds. (evaluates an expression a specified number of milliseconds has elapsed)