<%@ LANGUAGE="VBScript" %> <% Option Explicit Dim dtToday dtToday = Date() Dim dtCurViewMonth ' First day of the currently viewed month Dim dtCurViewDay ' Current day of the currently viewed month %> <% REM This section defines functions to be used later on. %> <% REM This sets the Previous Sunday and the Current Month %> <% '-------------------------------------------------- Function DtPrevSunday(ByVal dt) Do While WeekDay(dt) > vbSunday dt = DateAdd("d", -1, dt) Loop DtPrevSunday = dt End Function '-------------------------------------------------- %> <%REM Set current view month from posted CURDATE, or ' the current date as appropriate. ' if posted from the form ' if prev button was hit on the form If InStr(1, Request.Form, "subPrev", 1) > 0 Then dtCurViewMonth = DateAdd("m", -1, Request.Form("CURDATE")) ' if next button was hit on the form ElseIf InStr(1, Request.Form, "subNext", 1) > 0 Then dtCurViewMonth = DateAdd("m", 1, Request.Form("CURDATE")) ' anyother time Else dtCurViewMonth = DateSerial(Year(dtToday), Month(dtToday), 1) End If %> <% REM --------BEGINNING OF DRAW CALENDAR SECTION-------- %> <% REM This section executes the event query and draws a matching calendar. %> <% Dim iDay, iWeek, sFontColor %>
<% For iDay = vbSunday To vbSaturday %> <%Next %> <% dtCurViewDay = DtPrevSunday(dtCurViewMonth) For iWeek = 0 To 5 Response.Write "" & vbCrLf For iDay = 0 To 6 Response.Write "" & vbCrLf dtCurViewDay = DateAdd("d", 1, dtCurViewDay) Next Response.Write "" & vbCrLf Next %> <%REM --------END OF DRAW CALENDAR SECTION-------- %>
<%=MonthName(Month(dtCurViewMonth)) & " " & Year(dtCurViewMonth)%>
<%=WeekDayName(iDay)%>
" If Month(dtCurViewDay) = Month(dtCurViewMonth) Then If dtCurViewDay = dtToday Then sFontColor = "#FF3300" Else sFontColor = "#000000" End If '---- Write day of month Response.Write "" Response.Write Day(dtCurViewDay) & "
" '---Else '---Response.Write " " End If Response.Write "