<p align="center"><span id="timer">시계</span></p>
<script language="JavaScript">
<!--
var flasher = false
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"
timer.innerHTML = "현재 시간 - " + theTime
timerID = setTimeout("updateTime()",1000)
}
updateTime()
//-->
</script>
<script language="JavaScript">
<!--
var flasher = false
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"
timer.innerHTML = "현재 시간 - " + theTime
timerID = setTimeout("updateTime()",1000)
}
updateTime()
//-->
</script>
'Web > Javascript' 카테고리의 다른 글
해상도 알기 (0) | 2013.09.26 |
---|---|
분리해서 배열로 (0) | 2013.09.26 |
붙여넣기 (0) | 2013.09.26 |
캐시생성 (SELECT)(셀렉트) (0) | 2013.09.26 |
윤년에 따른 날자 구하기 (0) | 2013.09.26 |