日期:2014-05-18  浏览次数:20758 次

您好,您能否给我看一下我的这个程序。非常谢谢!
您好,您能否给我看一下我的这个程序。谢谢!
我有一个日历提醒的源程序,当点击每一天时,可以输入今天需要提醒的内容,
我想问的是如何当我改变系统日期和时间时,它会自动的给与提示当天需要提
示的内容。这个输出的函数怎么写呢?谢谢您的帮助。

以下是我的源程序。
<script   LANGUAGE= "JavaScript ">
<!--
function   getDays(month,   year)   {
//   create   array   to   hold   number   of   days   in   each   month
var   ar   =   new   Array(12)
ar[0]   =   31   //   January
ar[1]   =   (leapYear(year))   ?   29   :   28   //   February
ar[2]   =   31   //   March
ar[3]   =   30   //   April
ar[4]   =   31   //   May
ar[5]   =   30   //   June
ar[6]   =   31   //   July
ar[7]   =   31   //   August
ar[8]   =   30   //   September
ar[9]   =   31   //   October
ar[10]   =   30   //   November
ar[11]   =   31   //   December

//   return   number   of   days   in   the   specified   month   (parameter)
return   ar[month]
}

function   getMonthName(month)   {
//   create   array   to   hold   name   of   each   month
var   ar   =   new   Array(12)
ar[0]   =   "一月 "
ar[1]   =   "二月 "
ar[2]   =   "三月 "
ar[3]   =   "四月 "
ar[4]   =   "五月 "
ar[5]   =   "六月 "
ar[6]   =   "七月 "
ar[7]   =   "八月 "
ar[8]   =   "九月 "
ar[9]   =   "十月 "
ar[10]   =   "十一月 "
ar[11]   =   "十二月 "

//   return   name   of   specified   month   (parameter)
return   ar[month]
}

function   setCal()   {
//   standard   time   attributes
var   now   =   new   Date()
var   year   =   now.getYear()
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)
}

function   drawCal(firstDay,   lastDate,   date,   monthName,   year)   {
//   constant   table   settings
var   headerHeight   =   30   //   height   of   the   table 's   header   cell
var   border   =   1   //   3D   height   of   table