打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
asp 日历
过程名:echo
'作  用:输出html
'参  数:str ----输出的内容
'///////////////////////////////////////////////////
Sub echo(str)
response.write(str)
response.Flush()
End Sub
'=======================================================
'获得当月天数
Function GetDays(tDate)   
dt1 = CDate(Year(tDate) & "-" & Month(tDate) & "-1") ' 得到本月第一天
dt2 = DateAdd("m",1,dt1) ' 得到下个月第一天
GetDays=DateDiff("d",dt1,dt2) ' 得到两个月的差
End Function
'=======================================================

sub makeCalendar()
dateStr=date()'或得当前日期
currY=year(dateStr)'获得当前年
currM=month(dateStr)'获得当前月
currD=day(dateStr)'获得当前日
firDate=currY&"-"&currM&"-1"'或得当月第一天
firWeek=weekDay(firDate,vbMonday)'或得当月第一天是星期几
maxDay=GetDays(dateStr)'获得当月的最大天数
days=maxDay+firWeek-1'获得表格的天数
if days mod 7 = 0 then
lines=int(days/7)-1
else
lines=fix(days/7)
end if
echo"<table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"" width=""600"" bgcolor=""#FFFFFF"">"&vbcrlf
echo" <caption>"&currM&"月份日历</caption>"
echo"  <tr>"&vbcrlf
echo"    <th width=""14%"" height=""40"">日</th>"&vbcrlf
echo"    <th width=""14%"">一</th>"&vbcrlf
echo"    <th width=""14%"">二</th>"&vbcrlf
echo"    <th width=""14%"">三</th>"&vbcrlf
echo"    <th width=""14%"">四</th>"&vbcrlf
echo"    <th width=""14%"">五</th>"&vbcrlf
echo"    <th width=""14%"">六</th>"&vbcrlf
echo"  </tr>"&vbcrlf
for i=0 to lines
echo"  <tr>"&vbcrlf
 for j=1 to 7
square=7*i+j-firWeek
if square<1 or square>maxDay then
echo"<td height=""40""> </td>"&vbcrlf
elseif square=currD then
echo"<td id='curr'>"&square&"</td>"&vbcrlf
else
echo"<td height=""40"">"&square&"</td>"&vbcrlf
end if
 next
echo"  </tr>"&vbcrlf
 next
echo"</table>"&vbcrlf

end sub

call makeCalendar()'生成日历


CSS部分:
caption{font-size:16px; font-weight:bold; padding:10px;}
th,td{padding:5px;}
th{border:1px solid #5C47C2;}
td{text-align:center; border:1px solid #CCC;}
#curr{background-color:#EEE;}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
四个好看的CSS样式表格
一款精美flash-日历、时钟、闹钟
PHP生成数据字典
超强超靓网页日历代码(博客特效)
静海深流 的 一款精美flash-日历、时钟、闹钟
easyui dataGrid 左右两个datagrid 相互移动数据
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服