JAVASCRIPT create timer stop and reset button javascript - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

create timer with stop and reset button using javascript


 382

Show ResultJAVASCRIPT


2

<html>
<head>
<title></title>
<meta charset="utf-8">
<script type="text/javascript">
var sec = 0;
function pad(val) { return val > 9 ? val : "0" + val; }
var func;

function timerstart() {
func = setInterval(function () {
document.getElementById("seconds").innerHTML = pad(++sec % 60);
document.getElementById("minutes").innerHTML = pad(parseInt(sec / 60, 10));
}, 1000);
}
timerstart();

function myStopFunction() {
clearInterval(func);
}
function myClearFunction() {
myStopFunction();
document.getElementById("seconds").innerHTML = pad(00);
document.getElementById("minutes").innerHTML = pad(00);
sec = 0;
}
</script>
</head>
<body>
<div class="quiz-time">
<div class="timer">
<span id="minutes">00</span>:<span id="seconds">00</span>
</div>
<button onclick="myStopFunction()">Stop</button>
<button onclick="timerstart()">Start Again</button>
<button onclick="myClearFunction();">Clear</button>
</div>
</body>

</html>


By     Created   
The power of the user (%)
6%



The most helpful JAVASCRIPT solutions

How to get client machine name or computer name with javascript ?How to get client machine name or computer name with javascript ?JAVASCRIPT

Click to see more ...

  6.2K     388

get client hostname javascriptget client hostname javascriptJAVASCRIPT

Click to see more ...

  3.4K     271

detect ie javascriptdetect ie javascriptJAVASCRIPT

Click to see more ...

  2.2K     186

Create fireworks using javascriptCreate fireworks using javascriptJAVASCRIPT

Click to see more ...

  1.8K     146

create 3d barrel using javascriptcreate 3d barrel using javascriptJAVASCRIPT

Click to see more ...

  1.6K     103

create qr code javascriptcreate qr code javascriptJAVASCRIPT

Click to see more ...

  1K     99

how to create foreach class using javascript ?how to create foreach class using javascript ?JAVASCRIPT

Click to see more ...

  1.2K     97

fire event when user is idle javascriptfire event when user is idle javascriptJAVASCRIPT

Click to see more ...

  1.4K     97

get ip address javascriptget ip address javascriptJAVASCRIPT

Click to see more ...

  872     76

get filename using javascript get filename using javascript JAVASCRIPT

Click to see more ...

  639     62