Timer using Jquery.
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
</head>
<body>
<input ="text" id="i1"/>
<button id="start">start</button>
<button id="stop">stop</button>
<button id="reset">reset</button>
<script>
var counter=0;
var timer=0;
$('#start').on('click',function(){
timer=setInterval(function(){
$('#i1').val(++counter);
},300);
});
$('#stop').on('click',function(){
clearInterval(timer);
});
$('#reset').on('click',function(){
$('#i1').val(0);
counter=0;
});
})();
</script>
</body>
</html>
You can check the live demo on http://jsfiddle.net/informativejavascript/AWGD6/9/
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
</head>
<body>
<input ="text" id="i1"/>
<button id="start">start</button>
<button id="stop">stop</button>
<button id="reset">reset</button>
<script>
var counter=0;
var timer=0;
$('#start').on('click',function(){
timer=setInterval(function(){
$('#i1').val(++counter);
},300);
});
$('#stop').on('click',function(){
clearInterval(timer);
});
$('#reset').on('click',function(){
$('#i1').val(0);
counter=0;
});
})();
</script>
</body>
</html>
You can check the live demo on http://jsfiddle.net/informativejavascript/AWGD6/9/