vorrei realizzare un calendario in questa forma
http://www.battipagliaonline.com/rub...lta=30/04/2007
esiste già qualcosa di fatto?
vorrei realizzare un calendario in questa forma
http://www.battipagliaonline.com/rub...lta=30/04/2007
esiste già qualcosa di fatto?
come lo integro con il database
<%@ Language=VBSCRIPT%>
<%Option Explicit %>
<%
Function GetMonthName(Mesi)
Select Case Mesi
Case 1: GetMonthName="Gennaio"
Case 2: GetMonthName="Febbraio"
Case 3: GetMonthName="Marzo"
Case 4: GetMonthName="Aprile"
Case 5: GetMonthName="Maggio"
Case 6: GetMonthName="Giugno"
Case 7: GetMonthName="Luglio"
Case 8: GetMonthName="Agosto"
Case 9: GetMonthName="Settembre"
Case 10: GetMonthName="Ottobre"
Case 11: GetMonthName="Novembre"
Case 12: GetMonthName="Dicembre"
Case Else:
GetMonthName="**Mese Errato**"
End Select
End Function
Dim dataCorrente
dataCorrente = Request("Date")
If Len(dataCorrente) = 0 then
dataCorrente = Date()
end if
Dim aCalendarDays(42)
Dim iFirstWeekday
iFirstWeekday = DatePart("w" ,DateSerial(Year(dataCorrente), Month(dataCorrente),1))
Dim iDaysInMonth
iDaysInMonth = DatePart("d" ,DateSerial(Year(dataCorrente), Month(dataCorrente)+ 1, 1-1))
Dim iLoop
For iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekday - 1) = iLoop
Next
Dim iColumns , iRows
iColumns = 7
iRows = 6 - Int((42 -(iFirstWeekDay + iDaysInMonth)) / 7)
Dim strPrevMonth, strNextMonth
strPrevMonth = Server.URLEncode(DateAdd("m", - 1, dataCorrente))
strNextMonth = Server.URLEncode(DateAdd("m", 1, dataCorrente))
%>
<html>
<head>
<title> Calendario by Massimo61</title>
<style>
a:link {font-family:verdana; font-size:10px;color:#333399;text-decoration:none;}
a:visited {font-family:verdana; font-size:10px;color:#550000;text-decoration:none;}
a:hover {font-family:verdana; font-size:10px;color:#ff0000;}
</style>
</head>
<body bgcolor="#FFFFFF">
<table align="center" border="1" cellspacing="1" width="70%" height="70%" cellpadding="0">
<tr>
<th>
Mese precedente
</th>
<th colspan="5">
<font face="Verdana" size="4">
<%
response.write GetMonthName(Month(dataCorrente))
response.write " " & Year(dataCorrente)
%>
</font>
</th>
<th>
Mese successivo
</th>
</tr>
<%
Dim iRowsLoop, iColumnsLoop
for iRowsLoop = 1 to iRows
response.write "<tr>"
for iColumnsLoop = 1 to iColumns
if aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop) > 0 then
response.write "<td valign=""center"" align=""center"" width=""10%"">"
response.write "<font face=""Verdana"" size=""2"">"&aCalendarDays((iRowsLoop-1)* 7 + iColumnsLoop)&"</font>"
response.write "</td>"
else
response.write "<td bgcolor=""#000000"" valign=""center"" align=""center"" width=""10%""><font face=""Verdana"" size=""2""></font></td>"
end if
next
response.write "</tr>"
next
%>
</table>
<center>
<form method=get action="calendario.asp">
<font face="Arial" size="2">Scegli un mese Specifico</font>
<select size="1" name="Date">
<option value="<%=DateSerial(Year(dataCorrente),1 , 1)%>"
<% if Month(dataCorrente) = 1 then response.write "selected" %>>Gennaio</option>
<option value="<%=DateSerial(Year(dataCorrente),2 , 1)%>"
<% if Month(dataCorrente) = 2 then response.write "selected" %>>Febbraio</option>
<option value="<%=DateSerial(Year(dataCorrente),3 , 1)%>"
<% if Month(dataCorrente) = 3 then response.write "selected" %>>Marzo</option>
<option value="<%=DateSerial(Year(dataCorrente),4 , 1)%>"
<% if Month(dataCorrente) = 4 then response.write "selected" %>>Aprile</option>
<option value="<%=DateSerial(Year(dataCorrente),5 , 1)%>"
<% if Month(dataCorrente) = 5 then response.write "selected" %>>Maggio</option>
<option value="<%=DateSerial(Year(dataCorrente),6 , 1)%>"
<% if Month(dataCorrente) = 6 then response.write "selected" %>>Giugno</option>
<option value="<%=DateSerial(Year(dataCorrente),7 , 1)%>"
<% if Month(dataCorrente) = 7 then response.write "selected" %>>Luglio</option>
<option value="<%=DateSerial(Year(dataCorrente),8 , 1)%>"
<% if Month(dataCorrente) = 8 then response.write "selected" %>>Agosto</option>
<option value="<%=DateSerial(Year(dataCorrente),9 , 1)%>"
<% if Month(dataCorrente) = 9 then response.write "selected" %>>Settembre</option>
<option value="<%=DateSerial(Year(dataCorrente),10 , 1)%>"
<% if Month(dataCorrente) = 10 then response.write "selected" %>>Ottobre</option>
<option value="<%=DateSerial(Year(dataCorrente),11 , 1)%>"
<% if Month(dataCorrente) = 11 then response.write "selected" %>>Novembre</option>
<option value="<%=DateSerial(Year(dataCorrente),12 , 1)%>"
<% if Month(dataCorrente) = 12 then response.write "selected" %>>Dicembre</option>
</select>
<input type=submit value="Vai al Mese">
</form>
</center>
</body>
</html>
come lo integro con il database
<%@ Language=VBSCRIPT%>
<%Option Explicit %>
<%
Function GetMonthName(Mesi)
Select Case Mesi
Case 1: GetMonthName="Gennaio"
Case 2: GetMonthName="Febbraio"
Case 3: GetMonthName="Marzo"
Case 4: GetMonthName="Aprile"
Case 5: GetMonthName="Maggio"
Case 6: GetMonthName="Giugno"
Case 7: GetMonthName="Luglio"
Case 8: GetMonthName="Agosto"
Case 9: GetMonthName="Settembre"
Case 10: GetMonthName="Ottobre"
Case 11: GetMonthName="Novembre"
Case 12: GetMonthName="Dicembre"
Case Else:
GetMonthName="**Mese Errato**"
End Select
End Function
Dim dataCorrente
dataCorrente = Request("Date")
If Len(dataCorrente) = 0 then
dataCorrente = Date()
end if
Dim aCalendarDays(42)
Dim iFirstWeekday
iFirstWeekday = DatePart("w" ,DateSerial(Year(dataCorrente), Month(dataCorrente),1))
Dim iDaysInMonth
iDaysInMonth = DatePart("d" ,DateSerial(Year(dataCorrente), Month(dataCorrente)+ 1, 1-1))
Dim iLoop
For iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekday - 1) = iLoop
Next
Dim iColumns , iRows
iColumns = 7
iRows = 6 - Int((42 -(iFirstWeekDay + iDaysInMonth)) / 7)
Dim strPrevMonth, strNextMonth
strPrevMonth = Server.URLEncode(DateAdd("m", - 1, dataCorrente))
strNextMonth = Server.URLEncode(DateAdd("m", 1, dataCorrente))
%>
<html>
<head>
<title> Calendario by Massimo61</title>
<style>
a:link {font-family:verdana; font-size:10px;color:#333399;text-decoration:none;}
a:visited {font-family:verdana; font-size:10px;color:#550000;text-decoration:none;}
a:hover {font-family:verdana; font-size:10px;color:#ff0000;}
</style>
</head>
<body bgcolor="#FFFFFF">
<table align="center" border="1" cellspacing="1" width="70%" height="70%" cellpadding="0">
<tr>
<th>
Mese precedente
</th>
<th colspan="5">
<font face="Verdana" size="4">
<%
response.write GetMonthName(Month(dataCorrente))
response.write " " & Year(dataCorrente)
%>
</font>
</th>
<th>
Mese successivo
</th>
</tr>
<%
Dim iRowsLoop, iColumnsLoop
for iRowsLoop = 1 to iRows
response.write "<tr>"
for iColumnsLoop = 1 to iColumns
if aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop) > 0 then
response.write "<td valign=""center"" align=""center"" width=""10%"">"
response.write "<font face=""Verdana"" size=""2"">"&aCalendarDays((iRowsLoop-1)* 7 + iColumnsLoop)&"</font>"
response.write "</td>"
else
response.write "<td bgcolor=""#000000"" valign=""center"" align=""center"" width=""10%""><font face=""Verdana"" size=""2""></font></td>"
end if
next
response.write "</tr>"
next
%>
</table>
<center>
<form method=get action="calendario.asp">
<font face="Arial" size="2">Scegli un mese Specifico</font>
<select size="1" name="Date">
<option value="<%=DateSerial(Year(dataCorrente),1 , 1)%>"
<% if Month(dataCorrente) = 1 then response.write "selected" %>>Gennaio</option>
<option value="<%=DateSerial(Year(dataCorrente),2 , 1)%>"
<% if Month(dataCorrente) = 2 then response.write "selected" %>>Febbraio</option>
<option value="<%=DateSerial(Year(dataCorrente),3 , 1)%>"
<% if Month(dataCorrente) = 3 then response.write "selected" %>>Marzo</option>
<option value="<%=DateSerial(Year(dataCorrente),4 , 1)%>"
<% if Month(dataCorrente) = 4 then response.write "selected" %>>Aprile</option>
<option value="<%=DateSerial(Year(dataCorrente),5 , 1)%>"
<% if Month(dataCorrente) = 5 then response.write "selected" %>>Maggio</option>
<option value="<%=DateSerial(Year(dataCorrente),6 , 1)%>"
<% if Month(dataCorrente) = 6 then response.write "selected" %>>Giugno</option>
<option value="<%=DateSerial(Year(dataCorrente),7 , 1)%>"
<% if Month(dataCorrente) = 7 then response.write "selected" %>>Luglio</option>
<option value="<%=DateSerial(Year(dataCorrente),8 , 1)%>"
<% if Month(dataCorrente) = 8 then response.write "selected" %>>Agosto</option>
<option value="<%=DateSerial(Year(dataCorrente),9 , 1)%>"
<% if Month(dataCorrente) = 9 then response.write "selected" %>>Settembre</option>
<option value="<%=DateSerial(Year(dataCorrente),10 , 1)%>"
<% if Month(dataCorrente) = 10 then response.write "selected" %>>Ottobre</option>
<option value="<%=DateSerial(Year(dataCorrente),11 , 1)%>"
<% if Month(dataCorrente) = 11 then response.write "selected" %>>Novembre</option>
<option value="<%=DateSerial(Year(dataCorrente),12 , 1)%>"
<% if Month(dataCorrente) = 12 then response.write "selected" %>>Dicembre</option>
</select>
<input type=submit value="Vai al Mese">
</form>
</center>
</body>
</html>