Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[b]
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<body bgcolor="#FFFFD8">
<center><h1>MarkDMac's ASP Calendar Example</h1>
<%
'ASP Calendar by Mark D. MacLachlan, The Spider's Parlor
'URL http://www.thespidersparlor.com
'Creation Date 4/5/2004
'Copywrite (c)2004 All Rights Reserved
Dim DefaultCalendarBorderColor
Dim i,x
Dim iDayToDisplay
Dim weekstogo
Dim borderSize
Dim borderColor
DefaultCalendarBorderColor = "#000000"
borderSize = 1
borderColor = DefaultCalendarBorderColor
highlightcolor = "#8FBACB"
thisday = Day(Date)
myDate =Date
myDay = DatePart("D", Date)
iThisMonth = Month(Date)
iThisYear = Year(Date)
MyStartofMonth = (iThisMonth & "/1/" & iThisYear)
iThisMonthStartsThisDay=DatePart("W", MyStartofMonth)
' Store the month names into an array. Set element 0 to garbage so I don't have to do math later
Dim monthName
ReDim monthName(13)
monthName(0) = "Space"
monthName(1) = "January"
monthName(2) = "February"
monthName(3) = "March"
monthName(4) = "April"
monthName(5) = "May"
monthName(6) = "June"
monthName(7) = "July"
monthName(8) = "August"
monthName(9) = "September"
monthName(10) = "October"
monthName(11) = "November"
monthName(12) = "December"
'specify the background colors for the cells if month starts on Saturday
'Dim monthStartbgcolor
'If (thisday = 1) Then
' monthStartbgcolor="8FBACB"
'Else
' monthStartbgcolor="FFFFFF"
'End If
'calculate Number of days this month
If iThisMonth <> 12 Then
iDaysThisMonth = DateDiff("d",MyStartofMonth,((iThisMonth+1) & "/1/" & iThisYear))
Else
iDaysThisMonth = DateDiff("d",MyStartofMonth,("1/1/" & (iThisYear+1)))
End If
%>
<table cellpadding="4" cellspacing="1" border="0" bgcolor="#ffffff">
<tr><td colspan="7"align="center" bgcolor=<%Response.Write(Chr(34) & highlightcolor & Chr(34))%>><b>
<%Response.Write (monthName(iThisMonth) & " " & iThisYear) %></b></td></tr>
<% 'Write the row of weekday initials...%>
<tr>
<td align="center" bgcolor="#A1C6D1">S</td>
<td align="center" bgcolor="#A1C6D1">M</td>
<td align="center" bgcolor="#A1C6D1">T</td>
<td align="center" bgcolor="#A1C6D1">W</td>
<td align="center" bgcolor="#A1C6D1">T</td>
<td align="center" bgcolor="#A1C6D1">F</td>
<td align="center" bgcolor="#A1C6D1">S</td>
</tr>
<tr>
<%
'Now write the first row
For i= 1 to 7
if i=iThisMonthStartsThisDay Then
' // start with the numeral 1.
iDayToDisplay=1
elseif i>iThisMonthStartsThisDay Then
' // increment the date
iDayToDisplay = iDayToDisplay + 1
else
' // not first day yet? a non-breaking space
iDayToDisplay=" "
end if
if iDayToDisplay = thisDay Then
Response.Write ("<td align=center bgcolor="& highlightcolor & "><b>" & iDayToDisplay & "</b></td>")
else
Response.Write ("<td align=center>" & iDayToDisplay & "</td>")
end If
Next
%>
</tr>
<%
' Now, display the rest of the month.
' First figure out how many weeks are left to write
daysOffSet = 8-iThisMonthStartsThisDay
daysLeft = iDaysThisMonth-daysOffset
decWeekstogo = Round((daysLeft/7),2)
If decweekstogo > 4 Then
weekstogo = 5
ElseIf decweekstogo > 3 and decweekstogo <= 4 Then
weekstogo = 4
Else
weekstogo = 3
End if
'Now write the rows and populate the data
For x = 1 To weekstogo
Response.Write ("<tr>")
For i=1 To 7
If iDayToDisplay<iDaysThisMonth then
iDayToDisplay=iDayToDisplay + 1
else
iDayToDisplay=" "
End If
if iDayToDisplay = thisDay then
Response.Write ("<td align=center bgcolor=" & Chr(34)& highlightcolor & Chr(34) &"><b>" & iDayToDisplay & "</b></td>")
else
Response.Write ("<td align=center>" & iDayToDisplay & "</td>")
end If
Next
Response.Write ("</tr>")
Next
%>
</table>
</center>
</BODY>
</HTML>
[/b]