Home > php教程 > php手册 > 一个非常精彩的日历程序

一个非常精彩的日历程序

WBOY
Release: 2016-06-13 10:21:23
Original
1231 people have browsed it

豆腐制作 都是精品
http://www.asp888.net 豆腐技术站

我们经常需要的一些Web项目中用到日历,这样的脚本写起来又麻烦,功能又不够强大,现在豆腐给大家
提供一个功能强大的日历程序,这段脚本使用完全的客户端的js脚本制作,运行速度快。
下面大家就来看看,还有什么需要改进的地方,先看看效果再说吧!日历演示


豆腐日历



function getToday() {
//得到今天的年,月,日
this.now = new Date();
this.year = this.now.getFullYear();
this.month = this.now.getMonth();
this.day = this.now.getDate();
}


today = new getToday();

function newCalendar() {

today = new getToday();
var parseYear = parseInt(document.all.year
[document.all.year.selectedIndex].text);
var newCal = new Date(parseYear,
document.all.month.selectedIndex, 1);
var day = -1;
var startDay = newCal.getDay();
var daily = 0;
if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
day = today.day;
var tableCal = document.all.calendar.tBodies.dayList;
var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());
for (var intWeek = 0; intWeek for (var intDay = 0;intDay {
var cell = tableCal.rows[intWeek].cells[intDay];
if ((intDay == startDay) && (0 == daily))
daily = 1;
if(day==daily)
//今天,调用今天的Class
cell.className = "today";
else if(intDay==6)
//周六
cell.className = "sunday";
else if (intDay==0)
//周日
cell.className ="satday";
else
//平常
cell.className="normal";

if ((daily > 0) && (daily {
cell.innerText = daily;
daily++;
}
else
cell.innerText = "";
}
}

function getDate() {
var sDate;
//这段代码处理鼠标点击的情况
if ("TD" == event.srcElement.tagName)
if ("" != event.srcElement.innerText)
{
sDate = document.all.year.value + "年" + document.all.month.value + "月" + event.srcElement.innerText + "日";
alert(sDate);
}
}



豆腐制作,都是精品


豆腐技术站为大家提供最新最好的技术


















function Cancel() {
document.all.ret.value = "";
window.close();
}



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template