Calendar | calendar Sunday Monday Tuesday Wednesday Thursday Friday Saturday 1234567891011121314151617 1819202122232425262728293031 Source:
<%@ Language=vbscript%>
<Html>
<Title>
Small calendar
</title>
<body>
<%
Function Countdays (imonth,iyear)
Select Case Imonth
Case 1,3,5,7,8,10,12
Countdays=31
Case 2
If IsDate ("2/29/" & Iyear) Then
countdays=29
Else
Countdays=28
End If
Case 4,6,9,11
Countdays=30
End Select
End Function
Function FirstDay (imonth,iyear)
Firstday=weekday (Imonth & "/1/" & Iyear)
End Function
Dim mmonth,myear
Mmonth=month (Date ())
Myear=year (Date ())
Mdate=day (Date ())
Response.Write "<center>" & Myear & "Year" & Mmonth & "Month" & "</center>%>
<table border=1 align=center><tr>
<TD align=right> Sunday </td>
<TD align=right> Monday </td>
<TD align=right> Tuesday </td>
<TD align=right> Wednesday </td>
<TD align=right> Thursday </td>
<TD align=right> Friday </td>
<TD align=right> Saturday </td>
</tr><tr>
<%
J=1
For I=1 to 42
Response.Write "<td align=right>"
If I>=firstday (mmonth,myear) and J<=countdays (mmonth,myear) Then
If Mdate=j Then
Response.Write "<font color=blue>" & J & "</font>"
Else
Response.Write J
End If
J=j+1
Else
Response.Write ""
End If
Response.Write "</td>"
If I mod 7=0 then
Response.Write "</tr><tr>"
End If
Next
%>
</tr></table>
</body>
Since the next Learning Channel browsing the page as an HTML page, it is not possible to demonstrate the normal ASP code effect. The demo given above is a case where the code is interpreted by IIS. Users can copy the code and test the effect themselves.