웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
오늘 날짜와 시간
2003.05.20 18:16
날짜와 시간을 보여줍니다. 보니 날짜구하는 소스는 있는데 시간은 없더군요.
아무쪼록 도움이 되길 바랍니다.
---------- head 부분 시작 -------------
<script Language="JavaScript">
var timeStr, dateStr;
function clock() {
now= new Date();
hours= now.getHours();
minutes= now.getMinutes();
seconds= now.getSeconds();
timeStr= "" + hours;
timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;
document.clock.time.value = timeStr;
date= now.getDate();
month= now.getMonth()+1;
year= now.getYear();
dateStr= "" + month;
dateStr+= ((date < 10) ? "/0" : "/") + date;
dateStr+= "/" + year;
document.clock.date.value = dateStr;
Timer= setTimeout("clock()",1000);
}
</script>
------------ head 부분 끝 -----------------
------------ body 태그에 넣어주세요. -------------
<body onLoad="clock()">
------------ 페이지 적당한곳에 들어갈 부분 --------
<form name="clock">
시간:
<input type="text" name="time" size="8" value=""><br>
날짜:
<input type="text" name="date" size="8" value="">
</form>
아무쪼록 도움이 되길 바랍니다.
---------- head 부분 시작 -------------
<script Language="JavaScript">
var timeStr, dateStr;
function clock() {
now= new Date();
hours= now.getHours();
minutes= now.getMinutes();
seconds= now.getSeconds();
timeStr= "" + hours;
timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;
document.clock.time.value = timeStr;
date= now.getDate();
month= now.getMonth()+1;
year= now.getYear();
dateStr= "" + month;
dateStr+= ((date < 10) ? "/0" : "/") + date;
dateStr+= "/" + year;
document.clock.date.value = dateStr;
Timer= setTimeout("clock()",1000);
}
</script>
------------ head 부분 끝 -----------------
------------ body 태그에 넣어주세요. -------------
<body onLoad="clock()">
------------ 페이지 적당한곳에 들어갈 부분 --------
<form name="clock">
시간:
<input type="text" name="time" size="8" value=""><br>
날짜:
<input type="text" name="date" size="8" value="">
</form>
댓글 3
제목 | 글쓴이 | 날짜 |
---|---|---|
크롬리스(Chromless) 웹어플리케이션 -6 (최종) [4] | sundew | 2003.05.30 |
메뉴 옆에서 화살표가 스크롤되는.. [2] | 힘찬연못 | 2003.05.29 |
크롬리스(Chromless) 웹어플리케이션 -5 [3] | sundew | 2003.05.28 |
스크롤되는 레이어 나두 갖구 싶어서 ^^; 맹글어 봤습니다. [10] | M@xPond | 2003.05.28 |
오른쪽 버튼 클릭시 북마크창 띄우기(1석2조 방식) [4] | RedEye(rinja) | 2003.05.23 |
크롬리스(Chromless) 웹어플리케이션 -4 [4] | sundew | 2003.05.23 |
손님컴퓨터에 내홈피 즐겨찾기 원클릭으로추가시키기 [5] | 호호짱 | 2003.05.23 |
크롬리스(Chromless) 웹어플리케이션 -3 [5] | sundew | 2003.05.21 |
오늘 날짜와 시간 [3] | Brown | 2003.05.20 |
크롬리스(Chromless) 웹어플리케이션 -2 [5] | sundew | 2003.05.18 |
크롬리스(Chromless) 웹어플리케이션 -1 [1] | sundew | 2003.05.17 |
XXX는 객체가 아닙니다. [1] | RedEye | 2003.05.12 |
자바스크립트의 활용함에 대해.... [5] | RedEye | 2003.05.12 |
자바스크립트의 활용함에 대해 2 .... [1] | RedEye | 2003.05.18 |
[벅스 전용] 랜덤 음악 재생 Javascript. [1] | sundew | 2003.05.11 |
구문 오류 및 런타임 오류 모음 [1] | 아이쿠 | 2003.05.10 |
이벤트 핸들러 (Event Handler) 모음 [2] | 아이쿠 | 2003.05.10 |
랜덤 배경화면 구현하기 초간단 스크립트 공개(중복아님) [5] | 호호짱 | 2003.05.07 |
[배경음악] 첫곡은 랜덤, 그 이후로는 순차재생 [20] | 이주경 | 2003.05.06 |
[re] [소스] [배경음악] 첫곡은 랜덤, 그 이후로는 순차재생 --> 문제해결! [1] | 장진석 | 2003.06.02 |