GetDate()처럼 현재 날짜 출력 > script

본문 바로가기
사이트 내 전체검색

script

GetDate()처럼 현재 날짜 출력

페이지 정보

작성자 서방님 댓글 0건 조회 202회 작성일 07-07-31 20:36

본문

<head>
<title>상태바의 날자표시</title>
<script type="text/javascript">
<!--//
var id;

function getNowDate()
{
  var d = new Date();
  return d.getFullYear() + "-"
     + (String(eval(d.getMonth() + 1)).length == 1 ? 0 + String(eval(d.getMonth() + 1)) : String(eval(d.getMonth() + 1))) + "-"
     + (String(d.getDate()).length == 1 ? 0 + String(d.getDate()) : String(d.getDate())) + " "
     + (String(d.getHours()).length == 1 ? 0 + String(d.getHours()) : String(d.getHours())) + ":"
     + (String(d.getMinutes()).length == 1 ? 0 + String(d.getMinutes()) : String(d.getMinutes())) + ":"
     + (String(d.getSeconds()).length == 1 ? 0 + String(d.getSeconds()) : String(d.getSeconds()));
}

function printToStatus()
{
  window.status = getNowDate();
  id = setTimeout('printToStatus()', 1000);
}

function printStop()
{
  clearTimeout(id);
}
//-->
</script>
</head>
<body onload="printToStatus()">
 <h1>상태 표시줄에 시간 가는 예제</h1>
 <input id="Button1" type="button" value="시계작동" onclick="printToStatus()" />
 <input id="Button2" type="button" value="시계멈춤" onclick="printStop()" />
</body>
</html>

상태표시줄 확인

댓글목록

등록된 댓글이 없습니다.

Total 846건 42 페이지
게시물 검색

회원로그인

접속자집계

오늘
27
어제
302
최대
1,347
전체
155,088
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.