Small calendars-ASP instances

Source: Internet
Author: User
Tags date end html page
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>
&LT;TD align=right> Sunday </td>
&LT;TD align=right> Monday </td>
&LT;TD align=right> Tuesday </td>
&LT;TD align=right> Wednesday </td>
&LT;TD align=right> Thursday </td>
&LT;TD align=right> Friday </td>
&LT;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.



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.