Small calendar-asp instance

Source: Internet
Author: User
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 
 
 
 
 
 
 
 
 
 
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.
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.