什么是javascript中的setTimeOut()函数? [英] what is setTimeOut() function in javascript?
本文介绍了什么是javascript中的setTimeOut()函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在javascript中询问setTimeOut方法的功能吗?如下所示:
Can i ask what the function of setTimeOut method in javascript?As below:
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',500);
}
推荐答案
不确定你想要什么。
setTimeout
是全局窗口对象的一种方法。它在作为第二个参数传递的时间之后执行给定的函数(或计算给定的字符串)。
setTimeout
is a method of the global window object. It executes the given function (or evaluates the given string) after the time given as second parameter passed.
阅读更多关于 setTimeout
。
Read more about setTimeout
.
这篇关于什么是javascript中的setTimeOut()函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文