-
Notifications
You must be signed in to change notification settings - Fork 5
/
index1.html
53 lines (48 loc) · 1.72 KB
/
index1.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!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" />
<title>Countdown to New Year</title>
<link rel="stylesheet" href="style1.css" />
</head>
<body>
<video src="./video/fireworks.mp4" muted autoplay loop></video>
<audio src="./Tieng-phao-hoa-no-tren-bau-troi-www_tiengdong_com.mp3" autoplay loop ></audio>
<div class="container">
<h2>
<span>Countdown to New Year</span><span id="year">Calculating...</span>
</h2>
<div class="countdown">
<div id="day">NA</div>
<div id="hour">NA</div>
<div id="minute">NA</div>
<div id="second">NA</div>
</div>
</div>
<script type="text/javascript">
setInterval(function () {
let today = new Date();
let nextYear = today.getFullYear() + 1;
let countDate = new Date(`Jan 1, ${nextYear} 00:00:00`).getTime();
let now = new Date().getTime();
gap = countDate - now;
let second = 1000;
let minute = second * 60;
let hour = minute * 60;
let day = hour * 24;
let d = Math.floor(gap / day);
let h = Math.floor((gap % day) / hour);
let m = Math.floor((gap % hour) / minute);
let s = Math.floor((gap % minute) / second);
document.getElementById("day").innerText = d;
document.getElementById("hour").innerText = h;
document.getElementById("minute").innerText = m;
document.getElementById("second").innerText = s;
document.getElementById("year").innerHTML = nextYear;
// newYear();
}, 1000)();
</script>
</body>
</html>