网页的通用循环倒数计时器 [英] Universal, looping countdown timer for a web page

查看:64
本文介绍了网页的通用循环倒数计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找要在我的网站上放置的计时器,该计时器将设置为一个小时,并且在倒计时至零后,它将再次重置为一小时.它也必须是通用的,因此它对所有用户都显示相同,并且如果刷新页面,则不会重置为1小时.我猜这是相对简单的,但是我只能找到计时到一定时间并停止的计时器,或者刷新页面后从零开始计时的计时器.

I am looking for a timer to put on my website, and the timer would be set for an hour, and after it counts down to zero it resets back to one hour again. It also needs to be universal, so it displays the same for all users and does not reset back to 1hr if you refresh the page. I'm guessing this is relatively simple, however all I could find was timers which count to a certain time and stop, or timers which start back at zero after page refresh which is insufficient.

如果有人可以提供帮助或知道类似链接可用的链接,我将不胜感激!

If someone could help, or knows of a link where something like that is available I would greately appreciate it!

谢谢.

推荐答案

这是我知道会有所帮助的条件.

Here is a condition I know it will help.

ctsecs--;
if(ctsecs < 0) {
    if(ctmnts > 0) {
        ctsecs = 59;
        ctmnts--;
        if(cthrs > 0) {
            ctmnts = 59;
            cthrs--;
        } else {
            ctsecs = 0;
            ctmnts = 0;
            cthrs = 0;
        }
    }
}

这篇关于网页的通用循环倒数计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆