Link to home
Start Free TrialLog in
Avatar of JElster
JElsterFlag for United States of America

asked on

Javascript - Help with simple timer

Hi.. I'm trying to create a simple timer .  But the on Stop function does not stop my timer.
Any ideas what is wrong. How can I create a simple timer with a start and stop button.
thx



  onStart: function ()
        {  
            var that = this;  
           
            _count = 0;
                   
           var _timer = setInterval(function()
           {
                if (_count == 60)
                {
                    _count = 0
                }
               
                _count++;
               
                that.set("counter", _count);
               
            },1000);
           
        },

        onStop: function () {
            var that = this;
           
           
            clearTimeout();
            clearInterval();      
           
           
            that.clearForm();          
        },

        clearForm: function () {
            var that = this;
            that.set("counter", "0");
        },
SOLUTION
Avatar of mokaid83
mokaid83

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial