html组件html ponents之四--.

html组件html ponents之四--.

ID:24374479

大小:52.50 KB

页数:3页

时间:2018-11-14

html组件html ponents之四--._第1页
html组件html ponents之四--._第2页
html组件html ponents之四--._第3页
资源描述:

《html组件html ponents之四--.》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、HTML组件HTMLPONENTS之四>>.===编写日历一===  当calendar.html调用MYCAL:CALENDAR,当月的日历将会显示在页面中,函数setCal()是主要程序段,它初始化一些变量并调用drae()、getDays()和leapYear()。让我们从最后一个函数开始:  getDays()函数接收哪月值和哪年值,并且建立一个有12个元素的数组,用来存放每月的天数,哪一年用来决定是不是闰年,在闰年中二月是29天,而不是闰年是28天。该函数返回指定月份的天数。以下是getDays():functiongetDays(month,year){//cre

2、atearraytoholdnumberofdaysineachmonthvarar=neberar[9]=31;//Octoberar[10]=30;//Novemberar[11]=31;//December//returnnumberofdaysinthespecifiedmonth(parameter)returnar[month];}如果指定的年数可以被4整除,那么leapYear()函数将返回“true”,否则返回”false“:functionleapYear(year){if(year%4==0)//basicrulereturntrue;//isleapye

3、ar/*else*///elsenotneededentis"return"returnfalse;//isnotleapyear}getMonthName()函数返回指定月份的名字:functiongetMonthName(month){//createarraytoholdnameofeachmonthvarar=neber";ar[9]="October";ar[10]="November";ar[11]="December";//returnnameofspecifiedmonth(parameter)returnar[month];}setCal()函数是主模块,我

4、们在脚本的第一行调用它。该函数为当天(noeattributesvarnoonth=noonthName=getMonthName(month);vardate=noonth,andextractthedayononth,1);varfirstDay=firstDayInstance.getDay();firstDayInstance=null;//numberofdaysincurrentmonthvardays=getDays(month,year);//callfunctiontodraonthName,year);}[这篇文章来自..,]

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。