I wanna be able to disable this function using the same button again (click it again), so it would work like a toggle button to start the time counter and to end it whenever i want.

```
<span id="timer"></span>

<script>
var startTime = Date.now();

function myFunction() {
var interval = setInterval(function() {
    var elapsedtime = Date.now() - startTime;
    var secs = Math.floor(elapsedtime / 1000);
    var minutes = Math.floor(elapsedtime / (1000 * 60));
    var hours = Math.floor(elapsedtime / (1000 * 60 * 60));
    document.getElementById("timer").innerHTML = hours.toFixed(0) + 'h ' + minutes.toFixed(0) + 'm ' + secs.toFixed(0) + 's';
}, 1000);
}
</script>

<button onclick="myFunction()">Click me</button>

```

Also, in this code, the seconds keeps adding up more than 60, and i want them to reset to 0 whenever the secs counter reaches 60, is that possible?

One more thing, is there a way to record the counted time whenever i stop/toggle off the function?

Im a beginner so i hope you make it simple for me.