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
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title> 현재시간
</title>
</head>
 
<body onload="showClock()">
<div id="divClock" class="clock">
</div>
   
</body>
<script type="text/javascript">
      function showClock() {
         var currentDate = new Date();
         var divClock = document.getElementById("divClock");        
       
         var msg = "현재 시간: " + currentDate.getHours()+"시 "
         msg += currentDate.getMinutes() + "분 ";
         msg += currentDate.getSeconds() + "초 ";
         
         if (currentDate.getHours() >=12)
         {
         msg +="PM";
         }else{
         msg +="AM";
         } 
         
         divClock.innerText = msg;
         
         setTimeout(showClock, 1000);
      }
</script>
</html>
cs


+ Recent posts