ITPub博客

首页 > 应用开发 > IT综合 > HTML组件(HTMLCOMPONENTS)之四编写日历(3)(转)

HTML组件(HTMLCOMPONENTS)之四编写日历(3)(转)

原创 IT综合 作者:post0 时间:2007-08-15 10:16:55 0 删除 编辑
HTML组件(HTMLCOMPONENTS)之四编写日历(3)(转)[@more@]

===编写日历一===

setCal()函数是主模块,我们在脚本的第一行调用它。该函数为当天(now)、和每月的第一天(firstDayInstance)建立一个Date对象。用这些对象,setCal()函数解析出关于一个月的第一天、当日,和最后一天的所有信息。

function setCal() {

// standard time attributes

var now = new Date();

var year = now.getFullYear();

var month = now.getMonth();

var monthName = getMonthName(month);

var date = now.getDate();

now = null;

// create instance of first day of month, and extract the day on which it occurs

var firstDayInstance = new Date(year, month, 1);

var firstDay = firstDayInstance.getDay();

firstDayInstance = null;

// number of days in current month

var days = getDays(month, year);

// call function to draw calendar

drawCal(firstDay + 1, days, date, monthName, year);

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8225414/viewspace-957378/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    2018
  • 访问量
    8224946