File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ const clock = document . querySelector ( ".clock" ) ;
2+
3+ clock . addEventListener ( "load" , tick ) ;
4+
5+ function tick ( ) {
6+ const now = new Date ( ) ;
7+ const h = now . getHours ( ) ;
8+ const m = now . getMinutes ( ) ;
9+ const s = now . getSeconds ( ) ;
10+
11+ const html = `
12+ <span>${ h } :</span>
13+ <span>${ m } :</span>
14+ <span>${ s } </span>
15+ ` ;
16+ clock . innerHTML = html ;
17+ }
18+
19+ setInterval ( tick , 1000 ) ;
Original file line number Diff line number Diff line change 1+ < html lang ="en ">
2+ < head >
3+ < meta charset ="UTF-8 " />
4+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < title > Digital Clock</ title >
7+ < link rel ="stylesheet " href ="style.css " />
8+ </ head >
9+ < body >
10+ < div class ="clock "> </ div >
11+
12+ < script src ="app.js "> </ script >
13+ </ body >
14+ </ html >
Original file line number Diff line number Diff line change 1+ @import url ("https://fonts.googleapis.com/css2?family=Orbitron:wght@900&display=swap" );
2+
3+ body {
4+ background-color : black;
5+ font-family : "Orbitron" , sans-serif;
6+ display : flex;
7+ justify-content : center;
8+ align-items : center;
9+ }
10+
11+ .clock {
12+ color : # 20c20e ;
13+ font-size : 60px ;
14+ letter-spacing : 7px ;
15+ }
You can’t perform that action at this time.
0 commit comments