JElster
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");
},
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.