Kalender med lidt fejl
Hej jeg har prøvet a lave en kalenderhttp://www.aeronet.dk/calendar/calendar.asp
Den vriker med at finde ud af hvor mange dag der er i en mdr og går fint frem og tilbage i mdr.
men:
1. Den stiller ikke datoerne rigtigt op hvis man kigger på den så mener den at den 1. i mdr er en søndag altid.
2. Mdr i toppen står med lille begyndelses bogstav hvordan kan jeg få det med stort.
3. Kan jeg få den til at farve dagen idag (altså TD'en) i en hvid farve så den er mærkeret.
Håber nogle kan hjælpe mig med dette.
**************************************************
**************************************************
**************************************************
Min kode er:
<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include file="include/database.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<%
Response.Buffer = True
Session.LCID = 1030
%>
<head>
<title>Kalender</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<meta http-equiv="content-language" content="dan" />
<link rel="stylesheet" type="text/css" href="include/style.css" title="style" />
</head>
<body bgcolor="#ffffff">
<%
Dim themonth, theyear, firstday, thefirstDate, theleap, theleapNumbers, thelastDate, thelastYear, thenextYear, thelastMonth, thenextMonth
Dim dateCounter, weekCount, DateEnd, DateBegin, dateSelect, thefirstDay, thelastDay, strSQL
themonth = request.querystring("month")
theyear = request.querystring("year")
If themonth = "" Then
themonth = Month(Date)
End If
If theyear = "" Then
theyear = Year(Date)
End If
firstday = Weekday(CDate(themonth & "/" & 1 & "/" & theyear))
theleapNumbers = theyear / 4
theleap = (theleapNumbers) - Round(theleapNumbers)
If themonth = 2 Then
If theleap <> 0 Then
thelastDate = 28
Else
thelastDate = 29
End If
ElseIf ((themonth = 4) OR (themonth = 6) OR (themonth = 9) OR (themonth = 11)) Then
thelastDate = 30
Else
thelastDate = 31
End If
thelastMonth = themonth - 1
thelastYear = theyear
If thelastMonth < 1 Then
thelastMonth = 12
thelastYear = thelastYear - 1
End If
thenextMonth = themonth + 1
thenextYear = theyear
If thenextMonth > 12 Then
thenextMonth = 1
thenextYear = thenextYear + 1
End If
dateCounter = 1
weekCount = 1
DateEnd = thelastDate
DateBegin = thefirstDate
' HER STARTER LAYOUT FOR KALENDEREN
Dim Weekday_Font, Weekday_Font_Size, Weekday_Font_Color, Weekday_Background_Color, Date_Font, Date_Font_Size, Date_Font_Color, Date_Background_Color, Event_Font, Event_Font_Size, Event_Font_Color, Cell_Width, Cell_Height, Cell_Background_Color, Border_Size, Border_Color
Weekday_Font = "Tahoma"
Weekday_Font_Size = "1"
Weekday_Font_Color = "#FFCC33"
Weekday_Background_Color = "#3366CC"
Date_Font = "Tahoma"
Date_Font_Size = "1"
Date_Font_Color = "#FF0000"
Date_Background_Color = "#F0F0F0"
Event_Font = "Tahoma"
Event_Font_Size = "1"
Event_Font_Color = "#000000"
Cell_Width = "30"
Cell_Height = "23"
Cell_Background_Color = "#CCCCCC"
Border_Size = "1"
Border_Color = "#000000"
%>
<!-- HER STARTER TABEL OPSÆTNINGEN -->
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td align="left" valign="bottom"><font size="1" color=""><b>
<a href="calendar.asp?month=<%=thelastMonth%>&year=<%=thelastYear%>"><%=MonthName(thelastMonth)%></a>
</b></font></td>
<td align="center" valign="bottom"><font size="2"><b><%=MonthName(theMonth)%> <%=theyear%></b></font></td>
<td align="right" valign="bottom"><font size="1"><b>
<a href="calendar.asp?month=<%=thenextMonth%>&year=<%=thenextYear%>"><%=MonthName(thenextMonth)%></a>
</b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td bgcolor="#000000">
<table border="0" cellpadding="2" cellspacing="1">
<tr>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Søn</b></font>
</td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Man</b></font>
</td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Tir</b></font>
</td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Ons</b></font>
</td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Tor</b></font>
</td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Fre</b></font>
</td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>">
<font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b>Lør</b></font>
</td>
</tr>
<tr>
<%
Do while weekCount <= 7
dateSelect = themonth & "/" & dateCounter & "/" & theyear
%>
<% If (weekCount < thefirstDay) OR (dateCounter > thelastDate) Then %>
<td height="<%=Cell_Height%>" bgcolor="<%=Cell_Background_Color%>"><img src="images/clear.gif" height="1" width="1"></td>
<% else %>
<td height="<%=Cell_Height%>" bgcolor="<%=Date_Background_Color%>" valign="top">
<a href="date.asp?date=<%=dateSelect%>">
<font face="<%=Date_Font%>" size="<%=Date_Font_Size%>" color="<%=Date_Font_Color%>"><b><%=dateCounter%></b></font>
<font face="<%=Event_Font%>" size="<%=Event_Font_Size%>" color="<%=Event_Font_Color%>">
<%
Call OpenDB 'ÅBNING AF DATABASE
strSQL = "SELECT * FROM Events"
Set objRS = objConn.Execute(strSQL)
Do while NOT objRS.EOF
rsdate = objRS("Date")
If (Day(rsdate) = dateCounter) AND (Month(rsdate) = CInt(themonth)) AND (Year(rsdate) = CInt(theyear)) Then
%>
<br>
<%=objRS("Event_Name")%>
<%
End If
objConn.movenext
Loop
objConn.close
%>
</font></a>
</td>
<%
dateCounter = dateCounter + 1
end if
weekCount = weekCount + 1
Loop
weekCount = 1
%>
</tr>
<% Do while dateCounter <= thelastDate %>
<tr>
<%
Do while weekCount <= 7
dateSelect = themonth & "/" & dateCounter & "/" & theyear
%>
<% If dateCounter > thelastDate Then %>
<td height="<%=Cell_Height%>" bgcolor="<%=Cell_Background_Color%>">
<img src="images/clear.gif" height="1" width="1">
</td>
<% else %>
<td height="<%=Cell_Height%>" bgcolor="<%=Date_Background_Color%>" valign="top">
<a href="date.asp?date=<%=dateSelect%>">
<font face="<%=Date_Font%>" size="<%=Date_Font_Size%>" color="<%=Date_Font_Color%>"><b><%=dateCounter%></b></font>
<font face="<%=Event_Font%>" size="<%=Event_Font_Size%>" color="<%=Event_Font_Color%>">
<%
Call OpenDB 'ÅBNING AF DATABASE
strSQL = "SELECT * FROM Events"
Set objRS = objConn.Execute(strSQL)
Do while NOT objRS.EOF
rsdate = objRS("Date")
If (Day(rsdate) = dateCounter) AND (Month(rsdate) = CInt(themonth)) AND (Year(rsdate) = CInt(theyear)) Then
%>
<br>
<%=objRS("Event_Name")%>
<%
End If
objConn.movenext
Loop
objConn.close
%>
</font></a>
</td>
<%
dateCounter = dateCounter + 1
end if
weekCount = weekCount + 1
Loop
weekCount = 1
%>
</tr>
<% Loop %>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
