Reset JavaScript Counter?

后端 未结 1 1880
离开以前
离开以前 2021-01-29 04:46

I am trying to program a counter into a website via JavaScript and have found exactly what I need here: http://www.w3schools.com/js/js_timing.asp

What I am trying to do

1条回答
  •  失恋的感觉
    2021-01-29 05:43

    As far as I understand it, you need to call clearTimeout() function to reset the counter eg:

    var t = setTimeout("alert('I am displayed after 3 seconds!')", 3000);
    

    Later you can reset it like:

    clearTimeout(t);
    

    0 讨论(0)
提交回复
热议问题