Calendar program made by ASP

Source: Internet
Author: User
Tags end

纯ASP打造的日历程序,可自行美化,这里仅提供最简单的CSS样式。。。

<style>
body{font-size:12px margin:20px 0 0 20px; padding:0}
Tr,td{text-align:center;}
</style>
<%
'=================================
' Description: Calendar file
'=================================
' Take out the corresponding month blog log data
'=======================
Ryear = CInt (Request.QueryString ("Year"))
Rmonth = CInt (Request.QueryString ("month"))
If ryear = 0 Or ryear = NULL Then ryear = year (now)
If rmonth = 0 Or rmonth = NULL Then rmonth = month (now)
Nowtime = ryear& "-&Rmonth&"-1 "' get first day of this month
Nowyear = year (nowtime)
Nowmonth = month (nowtime) ' Month
Nowweekday = Weekday (nowtime)-1 ' Current week
' Get February days
Febdays = 28
If NOWYEAR/4 = 0 Then febdays = 29
' Get the number of days this month
If Nowmonth = 1 Then
Monthdays = 31
ElseIf Nowmonth = 2 Then
Monthdays = Febdays
ElseIf Nowmonth = 3 Then
Monthdays = 31
ElseIf Nowmonth = 4 Then
Monthdays = 30
ElseIf Nowmonth = 5 Then
Monthdays = 31
ElseIf Nowmonth = 6 Then
Monthdays = 30
ElseIf Nowmonth = 7 Then
Monthdays = 31
ElseIf Nowmonth = 8 Then
Monthdays = 31
ElseIf Nowmonth = 9 Then
Monthdays = 30
ElseIf Nowmonth = Then
Monthdays = 31
ElseIf Nowmonth = Then
Monthdays = 30
Else
Monthdays = 31
End If
Calendar = "<a href= ' calendar.asp?year=" &nowyear-1& "&month=" &nowmonth& "' > <<</a > "
Willshowmonthmonth = Nowmonth
If willshowmonthmonth-1 <= 0 Then willshowmonthmonth = 2
Calendar = Calendar & "<a href= ' calendar.asp?year=" &nowyear& "&month=" &willshowmonthmonth-1 & "' > <</a>"
If Willshowmonthmonth + 1 > Then willshowmonthmonth = 11
Calendar = Calendar & "<a href= ' calendar.asp?year=" &nowyear& "&month=" &willshowmonthmonth + 1 & "' > ></a>"
Calendar = Calendar & "<a href= ' calendar.asp?year=" &nowyear + 1& "&month=" &nowmonth& "' > & Gt;></a> "
Calendar = Calendar & "<table bgcolor= #000000 cellspacing=1 width=200><tr bgcolor= #ffffff ><td Colspan=7> "&nowyear&"-"&nowmonth&"-"&day" (now) & "</td></tr>" &vbcrlf
Calendar = Calendar & "<tr bgcolor= #ffffff >" &vbcrlf
Calendar = Calendar & "<td> Day </td>" &vbcrlf
Calendar = Calendar & "<td> one </td>" &vbcrlf
Calendar = Calendar & "<td> two </td>" &vbcrlf
Calendar = Calendar & "<td> three </td>" &vbcrlf
Calendar = Calendar & "<td> four </td>" &vbcrlf
Calendar = Calendar & "<td> five </td>" &vbcrlf
Calendar = Calendar & "<td> six </td>" &vbcrlf
Calendar = Calendar & "</tr>" &vbcrlf
Calendar = calendar & vbcrlf& "<tr bgcolor= #ffffff >" &vbcrlf
' Add the front blank.
Nowmonthfirstiweekday = Weekday (nowyear& "-" &nowmonth& "-1")-2 ' The week of the first day of the month
For I=0 to Nowmonthfirstiweekday
Calendar = Calendar & "<td bgcolor= #efefef > </td>" &vbcrlf
Next
' Start loop Write date
T=1
For I=1 to Monthdays
If year [Now] = year (nowyear& "-&nowmonth&"-"&i)" and "Today" = Day (nowyear& "-&nowmonth&" -"&i" Then ' Highlights today

Calendar = Calendar & "<td bgcolor= #cccccc ><a href= ' >" &i& "</a></td>" &vbcrlf
Else
Calendar = Calendar & "<td>" &i& "</td>" &vbcrlf
End If

If Weekday (nowyear& "-&nowmonth&"-"&i) = 7 Then
T=t+1
Calendar = Calendar & "</tr><tr bgcolor= #ffffff >" &vbcrlf
End If
Next
For I=1 to (7*t-(nowmonthfirstiweekday+1+monthdays))
Calendar = Calendar & "<td bgcolor= #ffffff ></td>" &vbcrlf
Next
Calendar = calendar & vbcrlf& "</tr>"
Calendar = Calendar & "</table>" &vbcrlf
Response.Write Calendar
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.