-
Notifications
You must be signed in to change notification settings - Fork 0
/
setInterval.html
36 lines (36 loc) · 1.23 KB
/
setInterval.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
body {
padding: 25px;
}
#elem {
height: 50px;
width: 350px;
}
</style>
<title>Document</title>
</head>
<body>
<h4 id="elem">
<button id="btn" class="btn btn-primary" type="button" onclick="showMessage()">Ver mensaje</button>
</h4>
<h4 id="date"></h4>
<script>
let dateElem = document.getElementById("date");
dateElem.innerHTML = new Date().toLocaleString();
const showMessage = () => {
document.querySelector("#btn").innerHTML = "⏳";
setTimeout(() => {
document.querySelector("#elem").innerHTML = "Sin televisión y sin cerveza Homero pierde la cabeza";
}, 3000);
}
setInterval(() => { dateElem.innerHTML = new Date().toLocaleString(); }, 1000);
</script>
</body>
</html>