-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs_clock.html
135 lines (123 loc) · 3.75 KB
/
js_clock.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Orologio</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Jacquard+12&family=Jersey+20+Charted&family=Jost:ital,wght@0,100..900;1,100..900&family=Orbitron:wght@714&family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
<style>
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
header{
width: 100%;
background-color: #F2C230;
}
header img{
width: 4%;
height: 4%;
padding: 10px;
}
body{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20px;
background-image: url(immagini/gradient12.jpg);
}
h2{
font-size: 5em;
font-family: "Poppins", system-ui;
font-weight: 500;
font-style: normal;
color: white;
text-transform: uppercase;
}
p{
font-size: 1em;
font-family: "Poppins", system-ui;
font-weight: 400;
font-style: normal;
color: white;
}
.box-watch{
width: 60%;
background-color: #161616;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
margin: 10%;
padding: 30px;
box-shadow: 7px 5px 10px 1px rgb(54, 54, 54);
}
.index-dates{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 19%;;
height: 120px;
}
.index-infodates{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 28%;
}
.hours-index{
display: flex;
gap: 20%;
width: 40%;
text-transform: capitalize;
align-items: center;
justify-content: center;
flex-direction: row;
}
#clock{
width: 350px;
text-align: center;
}
</style>
</head>
<body>
<header>
<a href="index.html"><img src="immagini/icon/js_blank.svg" alt="logo"></a>
</header>
<div class="box-watch">
<div class="index-dates">
<h2 id="today">we</h2>
<h2 id="clock">00:00:00</h2>
</div>
<div class="index-infodates">
<p>day</p>
<p class="hours-index"><b>hours</b><b>minute</b><b>second</b></p>
</div>
</div>
<script>
var clock = document.getElementById('clock');
var today_index = document.getElementById('today');
var today_list = ['Mon', 'Tue', 'We', 'Thu', 'Fri', 'Sat', 'Sun'];
setInterval(()=>{
var date_now = new Date();
var hours = date_now.getHours();
var minutes = date_now.getMinutes();
var second = date_now.getSeconds();
var today = today_list[date_now.getDay()];
today_index.innerHTML = today;
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
second = second < 10 ? '0' + second : second;
clock.innerHTML = hours + ':' + minutes + ':' + second;
}, 1000);
</script>
</body>
</html>