setTimeout()
來源:易賢網(wǎng) 閱讀:1235 次 日期:2014-10-09 11:13:11
溫馨提示:易賢網(wǎng)小編為您整理了“setTimeout()”,方便廣大網(wǎng)友查閱!

在Javascript給事件定時很容易。其關(guān)鍵指令是setTimeout()和clearTimeout()方法。利用setTimeout(), 指令可以在未來的某個指定時間執(zhí)行特定指令。如果你改變主意,你可以用clearTimeout()取消setTimeout的定時. 下面是setTimeout的基本格式:

var the_timeout = setTimeout("some javascript

statement", some_number_of_milliseconds);

在上面的例子中用到的指令如下:

var the_timeout = setTimeout("alertAndRedirect ();",3000);

<form name="the_form" >

<input type="text" name="the_text" />

</form>

<script language="javascript">

<!--

function doDumbTimer()

{

var timer1 = setTimeout("document.the_form.the_text.value='3 seconds!';",3000);

var timer2 = setTimeout("document.the_form.the_text.value='6 seconds!';",6000);

var timer3 = setTimeout("document.the_form.the_text.value='9 seconds!';",9000);

}

doDumbTimer();

-->

</script>

更多信息請查看IT技術(shù)專欄

更多信息請查看腳本欄目
下一篇:jsreplace使用
易賢網(wǎng)手機網(wǎng)站地址:setTimeout()
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點

版權(quán)所有:易賢網(wǎng)