with following code, i am getting result in seconds but i want result in H:m:s format for example if i getting result as 63 seconds then result should display like 1:03, how can i do this ?
<html>
<head>
<title>Start and Stop a Timer using JavaScript by DevCurry.com</title>
<script type="text/javascript">
var check = null;
window.onload = function(e) {
if (check == null) {
var cnt = 0;
check = setInterval(function () {
cnt += 1;
document.getElementById("para").innerHTML = cnt;
}, 1000);
}
};
function stop() {
clearInterval(check);
check = null;
document.getElementById("para").innerHTML = '0';
}
</script>
</head>
<body>
<div>
<p id="para">0</p>
<input id="btnStart" type="button" value="Start"
onclick="printDuration();" />
<input id="btnStop" type="button" value="Stop"
onclick="stop();" />
</div>
</body>
</html>