Is there any way to get this to run a stopwatch? I dont need any start or stop buttons, it should just run a stopwatch when the page loads and the stopwatch needs to keep running.
I have gotten everything else to work, but I cannot find a function that uses a format of 00:00 for a stopwatch. Is there any command that does that?
The "d.getSeconds()" isnt doing that for me.
new Date();
var testVar = window.setInterval(update, 10);
function update() {
var d = new Date();
document.getElementById("seconds").innerHTML = d.getSeconds();
}
#seconds {
background-color: yellow;
max-width: 17%;
}
<!DOCTYPE html>
<head>
<title>
Stop Watch
</title>
</head>
<body>
<h1>
Stop Watch
</h1>
<p>Elapsed Time:</p>
<p id="seconds"></p>
</body>
Is there any way to get the innerHTML to just be a regular stopwatch with "00:00" format?