반응형

뭐... 지금까지 썼던 내용의 반복이지만...

재귀호출과 timeout을 이용한 간단한 기술... ^^


다음의 스크립트를 해당 페이지의 head 태그 안에다 집어넣으면 된다. 



<script language="JavaScript">

<!--

function updateTime() {

var now = new Date()

var theHour = now.getHours()

var theMin = now.getMinutes()

var theSec = now.getSeconds()


var theTime = "" + ((theHour > 12) ? theHour - 12 : theHour)

theTime += ((theMin < 10) ? ":0" : ":") + theMin

theTime += ((theSec < 10) ? ":0" : ":") + theSec

theTime += (theHour >= 12) ? " pm" : " am"

theTime += ((flasher) ? " " : "♨")

window.status = "현재 시간은 :  " + theTime


flasher = !flasher;

timerID = setTimeout("updateTime()",1000)

}


var flasher = true;

updateTime();

//-->

</script>



이미 예전에 설명한 것들 뿐이니까 설명은 생략... ^^;



Posted by 떼르미
,
반응형


자바스크립트를 허용해주세요!
Please Enable JavaScript![ Enable JavaScript ]