jQuery链接日历实例分析
1。单击上面的箭头,切换到第一个月或下一个月,并链接。
2。只要不是真正的月份,那么日期都是灰色的。
两。分析:
1。当我们单击切换日期的箭头时,更改蓝色年份和顶部日期。
2。当我们单击切换日期的箭头时,以下TD的日期对应于上面显示的月份。
三.使用一个判断,不管是否真实月份,来控制TD的背景颜色,它是灰色的吗
演示下载
单击一个月前的更新
$()。
nowtitledatem --;
如果(nowtitledatem = = 11){
nowlastm = nowtitledatem-1
NextTitleDateY——
nexttitledatem = nowtitledatem + 1
nextlastm = 1
} else if(nowtitledatem = = 0){
NowTitleDateY——
nowtitledatem = 12;
nowlastm = nowtitledatem-1;
nexttitledatem = 1;
nextlastm = nexttitledatem + 1
} else if(nowtitledatem = = 1){
nowlastm = 12;
NextTitleDateM = nowTitleDateM+1
nextlastm = nexttitledatem + 1
其他{ }
nowlastm = nowtitledatem-1
nexttitledatem = nowtitledatem + 1
nextlastm = nexttitledatem + 1
}
日期和位置
更新();
迄今为止,他们插入的数量
InsertTd();
更新日期标题
UpdateTitle();
})
单击下个月
$()。
nowtitledatem + +;
如果(nowtitledatem = = 12){
nowlastm = nowtitledatem-1
nexttitledatey + +
nexttitledatem = 1
nextlastm = nexttitledatem + 1
} else if(nowtitledatem = = 11){
nowlastm = nowtitledatem-1
nexttitledatem = nowtitledatem + 1
nextlastm = 1
} else if(nowtitledatem = = 13){
nowtitledatey + +
nowtitledatem = 1;
NowLastM = 12;
nexttitledatem = nowtitledatem + 1;
nextlastm = nexttitledatem + 1
} else if(nowtitledatem = = 1){
nowlastm = 12;
nexttitledatem = nowtitledatem + 1
nextlastm = nexttitledatem + 1
其他{ }
nowlastm = nowtitledatem-1
nexttitledatem = nowtitledatem + 1
nextlastm = nexttitledatem + 1
}
日期和位置
更新();
迄今为止,他们插入的数量
InsertTd();
更新日期标题
UpdateTitle();
})
以上是本文的全部内容,希望能对您有所帮助,谢谢您的支持!