One of the cool things that I like about blogging is the little calendar you see on left side of most blogs. They resemble a lot the calendars you see in Outlook and Outlook Web Access. I always thought they we some funky Activex control that you had to sell your first born to buy but they are actually really easy to create using a little bit of script and html.
The hardest thing in this script was working out what week day the first day of the month is fortunately there are a couple of functions in VBS that help you out. This is a ASP sample that displays a small calendar
The next step is to see if I can get it to use a Exoledb script as a source for the calendar.
<table border="0" id="table1" cellpadding="2" width="147">
<tr><b><% response.write "<td style=""padding: 0"" width=""112"" align=""center"" colspan=""7"">
<b><font face=""Arial"" color=""#000080"">" & monthname(month(now())) & " " & Year(now()) & "</td>"
%></font></b> </tr>
<tr>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
S</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
M</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
T</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
W</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
T</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
F</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
S</td>
</tr>
<%
cdatefday = cdate(dateserial(year(now()),month(now()),"1"))
sday = weekday(cdatefday)
cmonth = month(now())
for x = 1 to 6
response.write "<tr>"
for i = 1 to 7
if cmonth = month(cdatefday) then
if sday =< i then
sday = 0
response.write "<td style=""padding: 0"" width=""16"" align=""center"">" & day(cdatefday) & "</td>"
cdatefday = dateadd("d",1,cdatefday)
else
response.write "<td style=""padding: 0"" width=""16"" align=""center""> </td>"
end if
else
response.write "<td style=""padding: 0"" width=""16"" align=""center""> </td>"
end if
next
response.write "</tr>"
next
%>
The hardest thing in this script was working out what week day the first day of the month is fortunately there are a couple of functions in VBS that help you out. This is a ASP sample that displays a small calendar
The next step is to see if I can get it to use a Exoledb script as a source for the calendar.
<table border="0" id="table1" cellpadding="2" width="147">
<tr><b><% response.write "<td style=""padding: 0"" width=""112"" align=""center"" colspan=""7"">
<b><font face=""Arial"" color=""#000080"">" & monthname(month(now())) & " " & Year(now()) & "</td>"
%></font></b> </tr>
<tr>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
S</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
M</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
T</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
W</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
T</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
F</td>
<td style="border-bottom-style: solid; padding: 0" width="16" align="center">
S</td>
</tr>
<%
cdatefday = cdate(dateserial(year(now()),month(now()),"1"))
sday = weekday(cdatefday)
cmonth = month(now())
for x = 1 to 6
response.write "<tr>"
for i = 1 to 7
if cmonth = month(cdatefday) then
if sday =< i then
sday = 0
response.write "<td style=""padding: 0"" width=""16"" align=""center"">" & day(cdatefday) & "</td>"
cdatefday = dateadd("d",1,cdatefday)
else
response.write "<td style=""padding: 0"" width=""16"" align=""center""> </td>"
end if
else
response.write "<td style=""padding: 0"" width=""16"" align=""center""> </td>"
end if
next
response.write "</tr>"
next
%>