用途:
設定經過多少時間再呼叫方法。
延遲時間呼叫方法。

說明:
setTimeout(要執行的方法,設定秒數);

程式範例:
<body>
<script type ="text/javascript">
//方法
function setText(){
var value = textID.value;
textID.value = value + "^^";
}
//設定1秒呼叫方法,只呼叫一次方法。
setTimeout("setText()",1000);

</script>
<input type="text" id="textID">
</body>


測試結果:

 
 
過1秒後









 















其它文章

arrow
arrow
    創作者介紹
    創作者 PG Levin Li 的頭像
    PG Levin Li

    程式開發學習之路

    PG Levin Li 發表在 痞客邦 留言(0) 人氣()