본문 바로가기
Developer/Javascript & jQuery

[Javascript] 현재시간 가져오기

by 순수한소년 2017. 1. 29.
728x90
반응형
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
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"> 
 
var today = new Date();
var hour = today.getHours(); 
if(hour>12){hour="오후 "+(hour-12);}
else{hour="오전 "+hour;}
var minute = today.getMinutes();
var second = today.getSeconds();
var mytime = '현재시간은 '+hour+'시 '+minute+'분 '+second+'초입니다.';
 
</SCRIPT> 
</HEAD>
<BODY BGCOLOR="black"> 
<TABLE WIDTH="100%" HEIGHT="100%"> 
<TR><TD VALIGN="top">
<SCRIPT LANGUAGE="JavaScript"> 
document.write("<FONT COLOR=\"white\">"+mytime+"</FONT>");
</SCRIPT>
</TD></TR>
<TR><TD ALIGN="center" VALIGN="middle">
<A HREF="#" onfocus="this.blur()"><IMG SRC="dot.jpg" BORDER="0"></A>
</TD></TR>
</TABLE>
</BODY>
</HTML>
 
 
cs


728x90
반응형