124098263
2016-12-13 15:54
怎么修改成自动的计时器啊
// var ret = 0;
// function getCurrentShowTimeSeconds() {
// ret++;
// return ret/20;
// }我像上面这样改,他也可以计时,但是当我离开这个页面去其他页面了后他就停止计时了,有没有其他更好的方法可以修复这个bug
var nowDate = new Date();
function getCurrentShowTimeSeconds() {
var curTime = new Date();
var ret1 = curTime.getHours()*3600 + curTime.getMinutes()*60 + curTime.getSeconds();
var ret0 = nowDate.getHours()*3600 + nowDate.getMinutes()*60 + nowDate.getSeconds();
return ret1 - ret0;
}这样修改就可以了!
炫丽的倒计时效果Canvas绘图与动画基础
96920 学习 · 1029 问题
相似问题