最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

setTimeout Method

Internet Development Index

Evaluates an expression after a specified number of milliseconds has elapsed.

Syntax

iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])

Parameters

vCode Required. Variant that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed.
iMilliSeconds Required. Integer爐hat specifies the number of milliseconds.
sLanguage Optional. String爐hat specifies one of the following values:
JScriptLanguage is JScript.
VBScriptLanguage is VBScript.
JavaScriptLanguage is JavaScript.

Return Value

Integer. Returns an identifier that cancels the evaluation with the clearTimeout method.

Remarks

In versions earlier than Microsoft® Internet Explorer 5, the first argument of setTimeout must be a string. Evaluation of the string is deferred until the specified interval elapses.

As of Internet Explorer 5, the first argument of setTimeout can be a string or a function pointer.

The specified expression or function is evaluated once. For repeated evaluation, use the setInterval method.

When you use the setTimeout method with Introduction to DHTML Behaviors, the value of vCode should be a function pointer to call a function within the HTML Component (HTC) file or a string to call a function in the primary document.

Examples

The following example uses the setTimeout method to evaluate a simple expression after one second has elapsed.

window.setTimeout("alert('Hello, world')", 1000);

The following example uses the setTimeout method to evaluate a slightly more complex expression after one second has elapsed.

var sMsg = "Hello, world";
window.setTimeout("alert(" + sMsg + ")", 1000);

This example uses the setTimeout method to hide a input type=button object after three seconds. If the user clicks the Count Down button and then counts to three, the Now You See Me button disappears.

<SCRIPT>
function fnHide(oToHide){
window.setTimeout("fnHide2(" + oToHide.id + ")", 3000);
}
function fnHide2(sID){
var o = eval(sID);
o.style.display="none";
}
</SCRIPT>
<INPUT TYPE=button VALUE="Count Down"
ID="oHideButton" onclick="fnHide(this)">

This example uses a function pointer to pass the data. In this case, the data is stored in a global variable because it cannot be passed directly. In the preceding example, the ID of the button is passed as a parameter to the function invoked by the setTimeout method. This is possible only when a string is passed as the first argument.

<SCRIPT>
var g_oToHide = null;
function fnHide(oToHide){
g_oToHide = oToHide;
window.setTimeout(fnHide2, 3000);
}
function fnHide2(sID){
if (g_oToHide) {
g_oToHide.style.display="none";
}
}
</SCRIPT>
<INPUT TYPE=button VALUE="Now you see me ..." ID="oHideButton"
onclick="fnHide(this)">
This feature requires Microsoft® Internet Explorer 3.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

There is no public standard that applies to this method.

Applies To

window

See Also

clearTimeout
芜湖市| 花垣县| 长治县| 荆门市| 章丘市| 景宁| 邢台县| 大宁县| 荆门市| 江西省| 镇巴县| 津南区| 米林县| 聂荣县| 彝良县| 遵义县| 蓬溪县| 中江县| 铁岭县| 屯留县| 得荣县| 承德县| 沾益县| 眉山市| 东乌珠穆沁旗| 类乌齐县| 金坛市| 洛宁县| 冕宁县| 庆阳市| 连云港市| 承德市| 永安市| 镇原县| 娱乐| 凤城市| 兖州市| 息烽县| 日照市| 徐州市| 文成县|