- window是指一個畫面視窗。
- setTimeout是指script再過某一特定時間後去執行某一敘述:
變數=window.setTimeout("Script",千分之一秒)。 - clearTimeout是指script取消某setTimeout的設定:
window.setTimeout(變數)。 - 運用範例如下:
<body onload="timer1()">
<script language=vbscript>
dim clock
sub timer1()
form1.text1.value=now
clock=window.settimeout("timer1()",102)
end sub
sub termin()
form1.text1.value=""
window.cleartimeout(clock)
end sub
</script>
<form id="form1">
<input type=text id="text1" value="">
<input type=button value="開始計時" onclick="timer1()">
<input type=button value="停止計時" onclick="termin()">
</form>
<script language=vbscript>
dim clock
sub timer1()
form1.text1.value=now
clock=window.settimeout("timer1()",102)
end sub
sub termin()
form1.text1.value=""
window.cleartimeout(clock)
end sub
</script>
<form id="form1">
<input type=text id="text1" value="">
<input type=button value="開始計時" onclick="timer1()">
<input type=button value="停止計時" onclick="termin()">
</form>