-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp02.html
More file actions
39 lines (39 loc) · 1.35 KB
/
app02.html
File metadata and controls
39 lines (39 loc) · 1.35 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>자바스크립트 응용 02 - 디지털 시계</title>
</head>
<style>
@font-face {
font-family: digital;
src: url("./digital-7.ttf");
}
* {font-family: digital, sanserif; font-size: 58px; color: red;}
#wrap {border: 12px solid black; background-color:rgb(65, 55, 55); padding: 20px; width: 350px; height: 70px; border-radius: 20px; box-shadow: 7px 7px rgba(128, 128, 128, 0.617);}
</style>
<!-- 오전 오후 나오게 -->
<body style="margin: 30px;">
<div id="wrap">
<span id="watch"></span>
</div>
<script>
var watch = document.getElementById("watch");
function tt(){
var today = new Date();
var hour = today.getHours();
var minute = today.getMinutes();
var seconds = today.getSeconds();
var ampm = hour<12?"am":"pm";
hour %= 12;
hour = hour<10? ("0"+hour):hour;
minute = minute<10? ("0"+minute): minute;
seconds = seconds<10? ("0"+seconds):seconds;
watch.innerHTML = ampm+" "+hour + " : "+minute+" : "+seconds;
}
tt();
var intv = setInterval(function(){tt();}, 1000);
</script>
</body>
</html>