【发布时间】:2020-08-10 23:06:29
【问题描述】:
我已经编写了这段代码来用 jQuery 设计数字时钟,但是我在某个地方跳过了主要代码,所以无法得到结果。
$( window ).load(function() {
setTimeout(function(){
var now=new Date();
var clock= now.getHours() + ":" + now.getMinutes() + ":" +
now.getSeconds();
$("#print").text(clock);
},1000);
});
【问题讨论】:
-
使用
setInterval代替setTimeout。
标签: javascript jquery load settimeout clock