인터넷정보

하단의 상태바에 날짜/시간/년도/요일 표시

알 수 없는 사용자 2007. 10. 17. 13:06
아래 소스는 head 내에 삽입하세요.


<SCRIPT LANGUAGE="JavaScript">
<!-- Hide this script from old browsers --
/*
This script came from the 24 hour JavaScripts Site
located at http://www.javascripts.com. It is brought to
you by Eric Jarvies, Lewis Sellers, Giuseppe Lombardo,
Kurt Anderson, and David Medinets.
*/
var timerID = null;
var timerRunning = false;
// Called by both onLoad in BODY tag, and Resume button.
function startclock ()
{
// Make sure the clock is stopped
stopclock();
time();
}
// Kills clock.
function stopclock ()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function time ()
{
var now = new Date();
var yr = now.getYear();
var mName = now.getMonth() + 1;
var dName = now.getDay() + 1;
var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
var hours = now.getHours();
hours = ((hours > 12) ? hours - 12 : hours);
var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
if(dName==1) Day = "일요일";
if(dName==2) Day = "월요일";
if(dName==3) Day = "화요일";
if(dName==4) Day = "수요일";
if(dName==5) Day = "목요일";
if(dName==6) Day = "금요일";
if(dName==7) Day = "토요일";
if(mName==1) Month="January";
if(mName==2) Month="February";
if(mName==3) Month="March";
if(mName==4) Month="April";
if(mName==5) Month="May";
if(mName==6) Month="June";
if(mName==7) Month="July";
if(mName==8) Month="August";
if(mName==9) Month="September";
if(mName==10) Month="October";
if(mName==11) Month="November";
if(mName==12) Month="December";
// String to display current date.
var DayDateTime=(" "
+ Day
+ " "
+ Month
+ " "
+ dayNr
+ ", "
+ ""
+ yr
+ " "
+ hours
+ minutes
+ seconds
+ " "
+ ampm
);
// Displays Day-Date-Time on the staus bar.
window.status=DayDateTime;
timerID = setTimeout("time()",1000);
timerRunning = true;
}
// Stops clock and clears status bar.
function clearStatus()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
window.status=" ";
}
// -- End Hiding Here -->
</SCRIPT>

다음 소스는 body에 넣으세요.
<body bgcolor="#FFFFFF" onload="startclock ()">

반응형