到目前为止我所做的一切都很好用,虽然我想要一个显示计时器上使用的时间的警报。
例如,在 00:10 启动计时器并在 -00:20 停止,消息提示应该说 30秒
我的问题是\UFFFFFFFF
这是STOP按钮,点击它会显示秒数,分钟,但是我遇到了麻烦。
如果客户那么久,我怎么能在那里形成分钟? JsFiddle
stopTimer()
答案 0 :(得分:1)
Confusion caused by counting seconds backwards seems to be the problem. On the fiddle in function stopTimer()
changing
if (seconds > 60) { // .... more than a minute
to
if(seconds < -60) { // ... more than a minute
causes code for over a minute to get executed (which as written has errors and will need debugging). To clarify the logic and make coding easier when counting backwards may I suggest calculating something like
var elapsedSeconds = - (seconds - totseconds);