실시간으로 초단위까지 보여지는 시계
본문
<HTML>
<HEAD>
<TITLE>실시간 시계</TITLE>
<SCRIPT language="JavaScript">
<!--
function DigitalTime()
{
if (!document.layers && !document.all)
return
var DigitalClock = new Date();
var hours = DigitalClock.getHours();
var minutes = DigitalClock.getMinutes();
var seconds = DigitalClock.getSeconds();
var dn = "AM";
if (hours >= 12)
{
dn = "PM";
hours = hours - 12;
}
if (hours == 0)
hours = 12;
if (minutes <= 9)
minutes = "0" + minutes;
if (seconds <= 9)
seconds = "0" + seconds;
digclock = hours + ":" + minutes + ":" + seconds + " " + dn ;
if (document.layers)
{
document.layers.liveclock.document.write(digclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML = digclock;
setTimeout("DigitalTime()",1000)
}
//-->
</script>
</HEAD>
<BODY onLoad="DigitalTime()">
<SPAN id="liveclock"></SPAN>
</body>
</html>
출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=79
<HEAD>
<TITLE>실시간 시계</TITLE>
<SCRIPT language="JavaScript">
<!--
function DigitalTime()
{
if (!document.layers && !document.all)
return
var DigitalClock = new Date();
var hours = DigitalClock.getHours();
var minutes = DigitalClock.getMinutes();
var seconds = DigitalClock.getSeconds();
var dn = "AM";
if (hours >= 12)
{
dn = "PM";
hours = hours - 12;
}
if (hours == 0)
hours = 12;
if (minutes <= 9)
minutes = "0" + minutes;
if (seconds <= 9)
seconds = "0" + seconds;
digclock = hours + ":" + minutes + ":" + seconds + " " + dn ;
if (document.layers)
{
document.layers.liveclock.document.write(digclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML = digclock;
setTimeout("DigitalTime()",1000)
}
//-->
</script>
</HEAD>
<BODY onLoad="DigitalTime()">
<SPAN id="liveclock"></SPAN>
</body>
</html>
출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=79
관련링크
댓글목록
등록된 댓글이 없습니다.