How do I stop the timer?

  • 0
    Who can tell you how you can stop the timer with the test for a while via the console?
    here is the timer code itself
    var today=new Date();
        var h=today.getHours();
        var m=today.getMinutes();
        var s=today.getSeconds();
        var i=h*3600+m*60+s;
        var done=0;
        var totalSecs=i+60;
        
        function SecondPast() {
            var today=new Date();
            if(totalSecs != null) timerId=setTimeout('SecondPast()', 1000);
            h=today.getHours();
            m=today.getMinutes();
            s=today.getSeconds();
            i=h*3600+m*60+s;
            if(i <= totalSecs) {
                document.getElementById('d_t').value=totalSecs-i;
                if(i >= totalSecs) document.answ.submit();
            }
        }
        
        function go(){
             document.getElementById('answ').submit();
        } 
        
        
        // subscribe to visibility change events
        document.addEventListener('visibilitychange', function () {
            if (document.visibilityState === 'hidden') {
            alert('Ви оштрафовані за спробу відкриття іншої вкладки браузера.');
            document.answ.submit();
            }
        });
        
        var s_cnt = 0;
        function not_dupl() {
            s_cnt++;
            if (s_cnt < 2) return true;
            return false;
        }

    Thank you all for any answer!
    JavaScript Anonymous, Mar 26, 2019

  • 1 Answers
  • 0
    clearTimeout (timerId):
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!