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>
상태표시줄 확인
댓글목록
등록된 댓글이 없습니다.