I'm a multimedia student who has been learning Javascript.
This morning I had the idea of trying to make a clock. Yes I know it's been done 24/7 on this forum, but not like I want it,
The thing I want: When you load the page, the clock starts at 00:00:00 (not at current time). and then every second comes by etc etc.
The code I got so far:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Teller</title>
<link rel="stylesheet" href="style.css">
<script>
var seconde;
var minute;
var hour;
function ClockLoader() {
seconde = setInterval(ClockTicker, 1000);
minute = setInterval(ClockTicker, 60000);
hour = setInterval(ClockTicker, 3600000);
}
function ClockTicker() {
var nummer = document.getElementById("secondeClock").innerHTML;
var nieuwNummer = document.getElementById("secondeClock").innerHTML + 1;
document.getElementById("secondeClock").innerHTML = nummer.replace(nieuwNummer, "");
}
function stopTheClock() {
clearInterval(seconde);
}
function startTheClock() {
seconde = setInterval(ClockTicker, 1000);
minuut = setInterval(ClockTicker, 60000);
uur = setInterval(ClockTicker, 3600000);
}
</script>
</head>
<body onload="ClockLoader(); ClockTicker();">
<div class="clock" id="hourClock">0</div>
<div class="clock" id="minuteClock">0</div>
<div class="clock" id="secondeClock">0</div>
<button onclick="startTheClock();">Start</button>
<br>
<button onclick="stopTheClock();">Stop</button>
</body>
</html>
I hope what I'm asking won't take much of your time, Thank you in advance!