Foros del Web » Programando para Internet » ASP Clásico »

calendario asp

Estas en el tema de calendario asp en el foro de ASP Clásico en Foros del Web. tengo este codigo de un calendario asp: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% 'pagina que recibirá la fecha seleccionada por el usuario Const URLDestino = "OtraPagina.asp" Dim MyMonth ...
  #1 (permalink)  
Antiguo 20/02/2008, 05:39
 
Fecha de Ingreso: febrero-2008
Mensajes: 30
Antigüedad: 16 años, 3 meses
Puntos: 0
calendario asp

tengo este codigo de un calendario asp:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'pagina que recibirá la fecha seleccionada por el usuario
Const URLDestino = "OtraPagina.asp"

Dim MyMonth 'Month of calendar
Dim MyYear 'Year of calendar
Dim FirstDay 'First day of the month. 1 = Monday
Dim CurrentDay 'Used to print dates in calendar
Dim Col 'Calendar column
Dim Row 'Calendar row

MyMonth = Request.Querystring("Month")
MyYear = Request.Querystring("Year")

If IsEmpty(MyMonth) then MyMonth = Month(Date)
if IsEmpty(MyYear) then MyYear = Year(Date)

Call ShowHeader (MyMonth, MyYear)

FirstDay = WeekDay(DateSerial(MyYear, MyMonth, 1)) -1
CurrentDay = 1

'Let's build the calendar
For Row = 0 to 5
For Col = 0 to 6
If Row = 0 and Col < FirstDay then
response.write "<td>&nbsp;</td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
response.write "<td>&nbsp;</td>"
else
response.write "<td"
if cInt(MyYear) = Year(Date) and cInt(MyMonth) = Month(Date) and CurrentDay = Day(Date) then
response.write " class='calCeldaResaltado' align='center'>"
else
response.write " align='center'>"
end if
response.write "<a href='" & URLDestino & "?day=" & CurrentDay _
& "&month=" & MyMonth & "&year=" & MyYear & "'>"
if cInt(MyYear) = Year(Date) and cInt(MyMonth) = Month(Date) and CurrentDay = Day(Date) then
Response.Write "<div class='calResaltado'>"
else
Response.Write "<div class='calSimbolo'>"
end if
Response.Write CurrentDay & "</div></a></td>"
CurrentDay = CurrentDay + 1
End If
Next
response.write "</tr>"
Next
response.write "</table></body></html>"


'------ Sub and functions


Sub ShowHeader(MyMonth,MyYear)
%>
<html>
<head>
<title>Horarios</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style>
.calFondoCalendario {background-color:cyan}
.calEncabe {font-family:Arial, Helvetica, sans-serif; font-size:11px}
.calFondoEncabe {background-color:lightgreen}
.calDias {font-family:Arial, Helvetica, sans-serif; font-size:9px; font-weight:900}
.calSimbolo {font-family:Arial, Helvetica, sans-serif; font-size:11px; text-decoration:none; font-weight:200; color:blue}
.calResaltado {font-family:Arial, Helvetica, sans-serif; font-size:11px; text-decoration:none; font-weight:700}
.calCeldaResaltado {background-color:lightyellow}
</style>
</head>

<body bgcolor='#FFFFFF'>

<table border='1' cellspacing='3' cellpadding='3' width='200' align='center' class="calFondoCalendario">
<tr align='center'>
<td colspan='7'>
<table border='0' cellspacing='1' cellpadding='1' width='100%' class="calFondoEncabe">
<tr>
<td align='left'>
<%
response.write "<a href = 'calendario2.asp?"
if MyMonth - 1 = 0 then
response.write "month=12&year=" & MyYear -1
else
response.write "month=" & MyMonth - 1 & "&year=" & MyYear
end if
response.write "'><span class='calSimbolo'><<</span></a>"

response.write "<span class='calEncabe'> <b>" & MonthName(MyMonth) & "</b> </span>"

response.write "<a href = 'calendario2.asp?"
if MyMonth + 1 = 13 then
response.write "month=1&year=" & MyYear + 1
else
response.write "month=" & MyMonth + 1 & "&year=" & MyYear
end if
response.write "'><span class='calSimbolo'>>></span></a>"
%>
</td>
<td align='center'>
<%
response.write "<a href = 'calendario2.asp?"
response.write "month=" & Month(Date()) & "&year=" & Year(Date())
response.write "'><div class='calSimbolo'><b>Hoy</b></div></a>"
%>
</td>
<td align='right'>
<%
response.write "<a href = 'calendario2.asp?"
response.write "month=" & MyMonth & "&year=" & MyYear -1
response.write "'><span class='calSimbolo'><<</span></a>"

response.write "<span class='calEncabe'> <b>" & MyYear & "</b> </span>"
response.write "<a href = 'calendario2.asp?"
response.write "month=" & MyMonth & "&year=" & MyYear + 1
response.write "'><span class='calSimbolo'>>></span></a>"
%>
</td>
</tr>
</table>
</td>
</tr>
<tr align='center'>
<td><div class='calDias'>D</div></td>
<td><div class='calDias'>L</div></td>
<td><div class='calDias'>M</div></td>
<td><div class='calDias'>M</div></td>
<td><div class='calDias'>J</div></td>
<td><div class='calDias'>V</div></td>
<td><div class='calDias'>S</div></td>
</tr>
<%
End Sub

Function MonthName(MyMonth)
Select Case MyMonth
Case 1
MonthName = "Enero"
Case 2
MonthName = "Febrero"
Case 3
MonthName = "Marzo"
Case 4
MonthName = "Abril"
Case 5
MonthName = "Mayo"
Case 6
MonthName = "Junio"
Case 7
MonthName = "Julio"
Case 8
MonthName = "Agosto"
Case 9
MonthName = "Septiembre"
Case 10
MonthName = "Octubre"
Case 11
MonthName = "Noviembre"
Case 12
MonthName = "Diciembre"
Case Else
MonthName = "ERROR!"
End Select
End Function

Function LastDay(MyMonth, MyYear)
' Returns the last day of the month. Takes into account leap years
' Usage: LastDay(Month, Year)
' Example: LastDay(12,2000) or LastDay(12) or Lastday


Select Case MyMonth
Case 1, 3, 5, 7, 8, 10, 12
LastDay = 31

Case 4, 6, 9, 11
LastDay = 30

Case 2
If IsDate(MyYear & "-" & MyMonth & "-" & "29") Then LastDay = 29 Else LastDay = 28

Case Else
LastDay = 0
End Select
End Function
%>

</body>
</html>


alguien me podria decir como guardar el dia en una variable para recuperarla en otrapagina.asp??
  #2 (permalink)  
Antiguo 20/02/2008, 08:45
Avatar de leoaraguas  
Fecha de Ingreso: febrero-2008
Ubicación: Rosario
Mensajes: 17
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: calendario asp

podrias probar con variables de sesion...

Session("nombreVariable")="valor"

la limitacion que tiene es que requiere que el usurio acepte cookies

sino, podrias pasarlo por post en un campo oculto.
  #3 (permalink)  
Antiguo 21/02/2008, 07:07
 
Fecha de Ingreso: febrero-2008
Mensajes: 30
Antigüedad: 16 años, 3 meses
Puntos: 0
Re: calendario asp

como hago para pasarlo por post en un campo oculto??
  #4 (permalink)  
Antiguo 21/02/2008, 07:45
Avatar de Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 4 meses
Puntos: 126
Re: calendario asp

Hola no entiendo tu preguta. Tienes esto

response.write "<a href='" & URLDestino & "?day=" & CurrentDay _
& "&month=" & MyMonth & "&year=" & MyYear & "'>"


que viene a pasar por la Query algo como

otrapagina.ass?day=21&month=2&year=2008

en otra pagina recoges el día, mes y año

Dim dia, mes, anyo
dia = request.querystring("day")
mes = request.querystring("month")
anyo = request.querystring("year")


Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />
  #5 (permalink)  
Antiguo 22/02/2008, 05:14
 
Fecha de Ingreso: febrero-2008
Mensajes: 30
Antigüedad: 16 años, 3 meses
Puntos: 0
Re: calendario asp

ahi esta... eso necesitaba... muchisimas gracias...
  #6 (permalink)  
Antiguo 14/06/2011, 10:15
 
Fecha de Ingreso: febrero-2011
Mensajes: 3
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: calendario asp

hola gente necesito de sus ayudas urgente, estoy utilizando este calendar, abra alguna manera de asignarle un color distinto solamente a los días feriados? ejemplo a día de navidad, año nuevo, etc y si se pudiese darle una etiqueta al pasar el puntero encima del día aparezca una pequeña descripción.
de antemano muy agradecido.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:56.