<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<script>
<!--
theDate = new Date("Jan 20,2006 11:11:53");
var theDate=new Date();
//-->
</script>
<body topmargin=0 marginheight=0 leftmargin=0 marginwidth=0 style='font-size:12px' oncontextmenu="self.event.returnValue=false">
<span id="clock" onMouseOut="document.all.lunar.style.display='block';this.style.display='none'" style="display:none; cursor:hand"></span>
<span id="lunar" onMouseOver="this.style.display='none';document.all.clock.style.display='block'" style="position:absolute; z-index:1; left: -2; top: -2; overflow: hidden;cursor:hand"></span>
<script language="Javascript">
<!--
var col = ":";
var year = theDate.getYear();
var month = theDate.getMonth()+1;
var day = theDate.getDate();
var hrs = theDate.getHours();
var mins = theDate.getMinutes();
var secs = theDate.getSeconds();
var theDay = theDate.getDay();
var nowDate = new Date();
var secd = secs - nowDate.getSeconds();
var ff2 = 1 ;
var ff3 = 1 ;
var ff4 = 0 ;
var isNewDay = 0;
if(secs==0 && mins==0 && hrs==0){isNewDay = 1};
if(secs==0) {ff4=1;}
var isclock=0;
var isclock1=0;
var isclock2=0;
var isclock3=0;
var clock1 = initClock(1);
var clock2 = initClock(2);
var clock3 = initClock(3);
var noticeStart = '<font color="#000000">';
var noticeEnd = "</font>";
getlunar(theDate);
function TheServerTime(){
var noww = new Date();
secs = noww.getSeconds() + secd;
secs = secs%60;
if(secs<0) secs=60+secs;
if(ff4==0 && secs == 0){secs = 0;mins++;ff3=1;ff4=1;}
if(secs != 00)ff4=0;
if(mins == 60){mins=00;hrs++;ff2=1}
if(hrs == 24){hrs=0;isNewDay=0;}
if(secs==0 && mins==0 && hrs==0 && isNewDay==0){
isNewDay = 1;
if(day>=28) {a_date=getNewDate(year, month, day);year=a_date[0];month=a_date[1];day=a_date[2];}
else{ day++;}
getlunar(new Date(year, month-1, day));
theDay++;
theDay = theDay%7;
}
if (hrs<=9&&ff2==1){ff2=0; hrs="0"+hrs;}
if (secs<=9) secs="0"+secs;
if (mins<=9&&ff3==1) {ff3=0; mins="0"+mins;}
if(navigator.appName == "Netscape") {
document.clock.document.write(noticeStart+month+"月"+day+"日"+" "+hrs+col+mins+" "+showweek(theDay))+noticeEnd;
document.clock.document.close();
}else if (navigator.appVersion.indexOf("MSIE") != -1){
clock.innerHTML = noticeStart+month+"月"+day+"日"+" "+hrs+col+mins+" "+showweek(theDay)+noticeEnd;
}
setTimeout("TheServerTime()",500);
}
TheServerTime();
function showweek(theDay){
switch(theDay) {
case 0: return "星期日";break;
case 1: return "星期一";break;
case 2: return "星期二";break;
case 3: return "星期三";break;
case 4: return "星期四";break;
case 5: return "星期五";break;
case 6: return "星期六";break;
}
}
function getNewDate(year, month, day) {
if(year%4 == 0) var theMonths = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
else var theMonths = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if(day == theMonths[month-1]){
day =1;month++;
}else{
day++;
}
if(month>12){month=1;year++;}
var a_date = new Array(year, month, day);
return a_date;
}
function getlunar(theDate) {
var arrLen=3;
var sValue=0;
var dayiy=0;
var miy=0;
var iyear=0;
var dayim=0;
var year2005="29;30;29;30;29;30;30;29;30;29;30;29";
var year2006="30;29;30;29;30;30;29;29;30;30;29;29;30";
var year2007="29;29;30;29;29;30;29;30;30;30;29;30";
var monthnormal="正月|二月|三月|四月|五月|六月|七月|八月|九月|十月|十一月|十二月";
var month2006="正月|二月|三月|四月|五月|六月|七月|闰七月|八月|九月|十月|十一月|十二月";
var Dn="初一|初二|初三|初四|初五|初六|初七|初八|初九|初十|十一|十二|十三|十四|十五|十六|十七|十八|十九|二十|廿一|廿二|廿三|廿四|廿五|廿六|廿七|廿八|廿九|三十";
var Ys=new Array(arrLen);
Ys[0]=1107878400;
Ys[1]=1138464000;
Ys[2]=1171728000;
var Yn=new Array(arrLen);
Yn[0]="乙酉年";
Yn[1]="丙戌年";
Yn[2]="丁亥年";
var ss=parseInt(theDate.getTime() / 1000);
for (var i=0; i<arrLen; i++)
if (ss>=Ys[i]){
iyear=i;
sValue=ss-Ys[i];
}
dayiy=parseInt(sValue/86400)+1;
var dpm=year2005;
if (iyear==1) dpm=year2006;
if (iyear==2) dpm=year2007;
dpm=dpm.split(";");
var Mn=monthnormal;
if (iyear==1) Mn=month2006;
Mn=Mn.split("|");
Dn=Dn.split("|");
dayim=dayiy;
var total=new Array(13);
total[0]=parseInt(dpm[0]);
for (i=1;i<dpm.length-1;i++) total[i]=parseInt(dpm[i])+total[i-1];
for (i=dpm.length-1;i>0;i--)
if (dayim>total[i-1]){
dayim=dayim-total[i-1];
miy=i;
break;
}
theLunar = '<table border="0" align="center" cellpadding="1" cellspacing="1" style="font-size:12px"><tr><td bgcolor="#FFFFE6">'+noticeStart+unescape('%u519C%u5386')+Yn[iyear]+' '+Mn[miy]+Dn[dayim-1]+noticeEnd+'</td></tr></table>';
if(navigator.appName == "Netscape") {
document.lunar.document.write(theLunar);
document.lunar.document.close();
}else if (navigator.appVersion.indexOf("MSIE") != -1){
lunar.innerHTML = theLunar;
}
}
function initClock(theType) {
var theValues= new Array(5);
var theClock = GetCookie_265("clockof265_"+theType);
if (theClock != null) {theValues = theClock.split("|-|");}
return theValues;
}
function GetCookie_265 (name){
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen){
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal_265 (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getCookieVal_265(offset){
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function DeleteCookie_265 (name){
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = 0;
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//-->
</script>
</body>
</html>
posted on 2006-04-03 14:42
汪杰 阅读(405)
评论(0) 编辑 收藏 引用 所属分类:
hengxing网站js