오늘날짜 현재시간 자바스크립트 인데..자문좀 주세요. > 자유게시판

자유게시판

오늘날짜 현재시간 자바스크립트 인데..자문좀 주세요. 정보

오늘날짜 현재시간 자바스크립트 인데..자문좀 주세요.

본문


 현재시간을 나타내주는 자바스크립트인데요.
음.. 이걸 실시간(자동)으로 만들었음 하는데.
방법을 모르겠네요.
자문점 주세요!!
<script type="text/javascript">
<!--
var now = new Date();
document.write(now.getYear(),'년');
document.write(now.getMonth()+1,'월',now.getDate(),'일');
if(now.getHours()>12)
{
    document.write('오후', now.getHours()-12, '시');
}
else
{
    document.write('오전', now.getHours(), '시');
}
document.write(now.getMinutes(),'분');
document.write(now.getSeconds(),'초');
//-->
</script>


ps. 날이 춥습니다. 건강조심하시고
      좋은하루되세요!

추천
0
  • 복사

댓글 9개

테러보이즈님이 말씀하셨듯 많은 소스들이 이미 있죠.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>JavaScript Code Block Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body>
<script type="text/javascript">
//<![CDATA[
var dt = Date( );
var msg ='<h3>Hello, World! Today is ' + dt + '</h3>';
document.writeln(msg);
//]]>
</script>
</body>
</html>
© SIRSOFT
현재 페이지 제일 처음으로