File tree 2 files changed +30
-22
lines changed
2 files changed +30
-22
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
3
< head >
4
+
4
5
< meta charset ="UTF-8 ">
5
6
< title > Javascript Digital Clock</ title >
6
- < link rel ="stylesheet " href ="style.css ">
7
+ <!--CSS link-->
8
+ < link rel ="stylesheet " href ="style.css ">
9
+
7
10
</ head >
8
11
< body >
12
+
9
13
< div class ="container ">
10
- jjj
14
+ < p id =" time " > </ p >
11
15
</ div >
12
- < script src ="script.js "> </ script >
16
+
17
+ <!--JavaScript Start-->
18
+ < script >
19
+ ( function ( ) {
20
+ function addZeroBefore ( v ) {
21
+ return + v < 10 ? "0" + + v : v ;
22
+ }
23
+
24
+ function showTime ( ) {
25
+
26
+ var today = new Date ( ) ;
27
+ var textTime = addZeroBefore ( today . getHours ( ) ) + " : " + addZeroBefore ( today . getMinutes ( ) ) + " : " + addZeroBefore ( today . getSeconds ( ) ) ;
28
+
29
+ document . getElementById ( "time" ) . innerHTML = textTime ;
30
+
31
+ setTimeout ( function ( ) {
32
+ showTime ( )
33
+ } , 1000 ) ;
34
+ }
35
+
36
+ showTime ( ) ;
37
+ } ) ( ) ;
38
+ </ script >
39
+ <!--JavaScript End-->
13
40
</ body >
14
41
</ html >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments