gesto
Posts: 42
|
Posted: 11/10/2005, 2:45 AM |
|
Many just want to display a calendar in the web page and canīt use the code in datepicker so here is a code sample ready to be used in your CCS page that you can manipulate as you wish.
Add a label field and set it to HTML
then in Beforeshow of this field add this code
dim Mes_ini, Mes_ini_dia, Mes_fin, Mes_fin_dia, Dia, Dia_Sem, i, Cont_Dia_Sem, Mes_Cal, Ano_Cal
Mes_Cal = month(Date)
Ano_cal = year(Date)
'primeiro dia do mes
MEs_ini = "01/" & Mes_Cal & "/" & Ano_Cal
Mes_ini_dia = 01
'last day of the month
Mes_Fin = DateAdd("d",-1,"01/" & month(Dateadd("m",1,Date)) & "/" & year(Dateadd("m",1,Date)))
Mes_Fin_Dia = Day(Mes_fin)
'open a table
eventCaller.value = "<table class='gerencialFormTABLE'><tr align='center'>"
'put the weekdays on top
for i = 1 to 7
eventCaller.value = eventCaller.value & "<td class='gerencialDataTD'><b>" & UCase(left(weekdayname(i),1)) & "</b></td>"
next
'set i to 0 to use it again
i = 0
eventCaller.value = eventCaller.value & "</tr><tr align='center'>"
'begin of month loop
for dia = mes_ini_dia to Mes_fin_dia step 1
eventCaller.value = eventCaller.value & "<td class='gerencialDataTD'>"
'see the weekday of the first day of the month
if dia = 1 then
Cont_Dia_Sem = weekday(CDate("0" & dia & "/" & Mes_Cal & "/" & Ano_Cal)) -1
for i = 1 to Cont_Dia_Sem step 1
eventCaller.value = eventCaller.value & " </td><td class='gerencialDataTD'>"
next
end if
eventCaller.value = eventCaller.value & dia & " "
'See the weekday of the month
if dia <10 then
Dia_Sem = weekday(CDate("0" & dia & "/" & Mes_Cal & "/" & Ano_Cal))
Cont_Dia_Sem = Cont_Dia_Sem + 1
else
Dia_Sem = weekday(CDate(dia & "/" & Mes_Cal & "/" & Ano_Cal))
Cont_Dia_Sem = Cont_Dia_Sem + 1
end if
'Add column
eventCaller.value = eventCaller.value & "</td>"
'if 7 days, change the line
if Cont_Dia_Sem = 7 then
eventCaller.value = eventCaller.value & "</tr><tr align='center'>"
Cont_Dia_Sem = 0
end if
'next day
next
eventCaller.value = eventCaller.value & "</table>"
and that's all...
|