Tag & Script/JavaScript
텍스트 시계
미련곰
2007. 8. 20. 15:25
<script type="text/javascript" >
function printTime(){
var clock=document.getElementById("clock");
var now = new Date();
clock.innerHTML = now.getFullYear()+"년"+
(now.getMonth()+1)+"월"+
now.getDate()+"일"+
now.getHours()+"시"+
now.getMinutes()+"분"+
now.getSeconds()+"초";
setTimeout("printTime()",1000);
}
function printTime(){
var clock=document.getElementById("clock");
var now = new Date();
clock.innerHTML = now.getFullYear()+"년"+
(now.getMonth()+1)+"월"+
now.getDate()+"일"+
now.getHours()+"시"+
now.getMinutes()+"분"+
now.getSeconds()+"초";
setTimeout("printTime()",1000);
}
window.onload = function(){
printTime();
}
</script>
현재 시간은 <span id="clock"></span>입니다
출처 : http://blog.naver.com/wizksy/150012954417