Source code:
<% @ 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 "& nbsp ;"
End if
Response. write "</td>"
If I mod 7 = 0 then
Response. write "</tr> <tr>"
End if
Next
%>
</Tr> </table>
</Body>
</Html>
The following learning channel browsing page is an html page, so normal asp code effects cannot be demonstrated. The above demonstration is a case after the code is explained through iis. You can test the effect by copying the code.
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.