blob: 63d26017cd092077fb6570e6bbde18ff877c182a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!DOCTYPE html>
<html>
<head>
<title>setInterval() test</title>
<script>
document.addEventListener("DOMContentLoaded", function () {
var output = document.getElementById("output");
var counter = 0;
function updateOutput () {
output.innerHTML = `setInterval() was called ${counter} times!`;
}
updateOutput();
setInterval(function () {
counter++;
updateOutput();
}, 1000);
});
</script>
</head>
<body>
<div id="output"></div>
</body>
</html>
|