打印本文 打印本文  关闭窗口 关闭窗口  
带农历的时间特效代码3来源于瑞达科技网
作者:佚名  文章来源:网络  点击数  更新时间:2011/1/5   文章录入:瑞达  责任编辑:瑞达

function dispDate(dateVal) {
DaystoAdd=dateVal
TodaysDate = new Date();
TodaysDay = new Array('星期日', '星期一', '星期二','星期三', '星期四', '星期五', '星期六');
TodaysMonth = new Array('1月', '2月', '3月','4月', '5月','6月', '7月', '8月', '9月','10月', '11月', '12月');
DaysinMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
function LeapYearTest (Year) {
if (((Year % 400)==0) || (((Year % 100)!=0) && (Year % 4)==0)) {
return true;
}
else {
return false;
}
}
CurrentYear = TodaysDate.getYear();
if (CurrentYear < 2000)
CurrentYear = CurrentYear + 1900;
currentMonth = TodaysDate.getMonth();
DayOffset = TodaysDate.getDay();
currentDay = TodaysDate.getDate();
month = TodaysMonth[currentMonth];
if (month == '二月') {
if (((CurrentYear % 4)==0) && ((CurrentYear % 100)!=0) || ((CurrentYear % 400)==0)) {
DaysinMonth[1] = 29;
}
else {
DaysinMonth[1] = 28;
}
}
days = DaysinMonth[currentMonth];
currentDay += DaystoAdd;
if (currentDay > days) {
if (currentMonth == 11) {
currentMonth = 0;
month = TodaysMonth[currentMonth];
CurrentYear = CurrentYear + 1
}
else {
month =
TodaysMonth[currentMonth+1];
}
currentDay = currentDay - days;
}
DayOffset += DaystoAdd;
function offsettheDate (offsetCurrentDay) {
if (offsetCurrentDay > 6) {
offsetCurrentDay -= 6;
DayOffset = TodaysDay[offsetCurrentDay-1];
offsettheDate(offsetCurrentDay-1);
}
else {
DayOffset = TodaysDay[offsetCurrentDay];
return true;
}
}
offsettheDate(DayOffset);
if (CurrentYear<100) CurrentYear="19" + CurrentYear;
TheDate = CurrentYear + '年' + month + currentDay + '日&nbsp;' + DayOffset;
document.write(' '+TheDate);
}
dispDate(0);
//日期时间显示
打印本文 打印本文  关闭窗口 关闭窗口