Ir para conteúdo
Fórum Script Brasil
  • 0

Agenda


Mateustg

Pergunta

olá, eu tenho uma agenda que está funcionando beleza em questão de mudança de dats, porém a mesma não aparece os meses para eu mudar, quando clico em ver próximo mês ou ver o mês anterior.

Alguém pode me ajudar a fazer com que este sistema avance ou volte, mudando os meses também?

eis o código:


<%Option Explicit%>

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Calendário</TITLE>
<META NAME="Generator" CONTENT="Microsoft FrontPage 4.0">
<META NAME="Author" CONTENT="Alexandre Sales Lima">
<META NAME="Keywords" CONTENT="Calendario">
<META NAME="Description" CONTENT="Calendario escrito em ASP">
<base target="frame">

</HEAD>

<BODY bgcolor=#ffffff>


<%
'Lógica para construir o calendário
Session.LCID = 1046 'BRASIL
Dim URL,Dia, Mes, Ano, Agora, PrimeiroDiaMes, UltimoDiaMes, Mes2,Varmes 
Dim Inicio,Fim, Start, TheEnd,i, j

URL= Request.ServerVAriables("SCRIPT_NAME")

if (Request.QueryString("Mes") <> Month(now))AND(Request.QueryString("Mes") <> "") Then
Mes=CInt(Request.QueryString("Mes"))'força que o resultado seja um inteiro
'mes2 = CInt(Month(date))
Select Case Mes
Case 1
  varmes = "mes" & mes & ".jpg"
Case 2
  varmes = "mes" & mes & ".jpg"
Case 3
  varmes = "mes" & mes & ".jpg"
Case 4
  varmes = "mes" & mes & ".jpg"
Case 5
  varmes = "mes" & mes & ".jpg"
Case 6
  varmes =  "mes" & mes & ".jpg"
Case 7
  varmes = "mes" & mes & ".jpg"
Case 8
  varmes = "mes" & mes & ".jpg"
Case 9
  varmes = "mes" & mes & ".jpg"
Case 10
  varmes = "mes" & mes & ".jpg"
Case 11
  varmes = "mes" & mes & ".jpg"
Case 12
  varmes = "mes" & mes & ".jpg"
End Select
else
Mes = Month(now)
mes2 = CInt(Month(date))
Select Case Mes
Case 1
  varmes = "mes" & mes & ".jpg"
Case 2
  varmes = "mes" & mes & ".jpg"
Case 3
  varmes = "mes" & mes & ".jpg"
Case 4
  varmes = "mes" & mes & ".jpg"
Case 5
  varmes = "mes" & mes & ".jpg"
Case 6
  varmes =  "mes" & mes & ".jpg"
Case 7
  varmes = "mes" & mes & ".jpg"
Case 8
  varmes = "mes" & mes & ".jpg"
Case 9
  varmes = "mes" & mes & ".jpg"
Case 10
  varmes = "mes" & mes & ".jpg"
Case 11
  varmes = "mes" & mes & ".jpg"
Case 12
  varmes = "mes" & mes & ".jpg"
End Select
end if

Dia=Day(now)

Ano = Year(now)
Agora = DateSerial(Ano, mes, dia)

PrimeiroDiaMes=DateSerial(Year(Now),Mes,1)
UltimoDiaMes=DateSerial(Year(Now),Mes+1,1-1)
Inicio = ABS(1 - WeekDay(PrimeiroDiaMes))
Fim = 7 - WeekDay(UltimoDiaMes)
Start=1-Inicio
TheEnd = Day(UltimoDiaMes) + Fim 
J=1 

'#############################################################
'# Inicio do meu código - Q Santa Luzia Ilumine meus olhinhos#
'#############################################################



%>
<!--#include file="conecta.asp"-->


<TABLE BORDER=0 WIDTH=194 CELLPADDING=0 ALIGN=left>
	<TR>
	<TD WIDTH="199" VALIGN=top style="border-style: solid; border-width: 1">
<div align="center">
  <center>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="120">


<TR bgcolor=white>
	<TD align="Center" width="195">
        <center><script>printDate();</script></center>
          </TD>
</TR>


<TR bgcolor=white>
	<TD align="Center" width="195">
  <TABLE  CELLSPACING=3 CELLPADDING=1 BORDER=0>
  <TR>
  	<TD COLSPAN=1 align="center" width="75"><img border="0" src="semana2.gif"></TD>
  </TR>
  </Table>
          </TD>
</TR>
<tr>
	<TD align="Center" width="195">
	<TABLE  CELLSPACING=3 CELLPADDING=1 BORDER=0 width="99">
  
	<TR bgcolor="#ffffff">

<%

AbreConexao
Dim sql, RSAgenda


For i= Start to TheEnd  
  
  if (i = day(now)) And (Mes=Month(now)) Then
      sql = "SELECT * FROM AGENDA WHERE day(dt_evento)="&i&" AND month(dt_evento)="&mes&" AND year(dt_evento)="&ano&""
      Set RSAgenda = conexao.execute(sql)
    If RSAgenda.EOF then%>
	<TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=black><b><%=Day(DateSerial(Year(Now),Mes,i))%></b></font></TD>
    <% else 
    'While NOT RSAgenda.EOF%>
     <TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=red><a href="cagenda.asp?dt=<%=RSagenda("dt_evento")%>&mes=<%=Mes%>" target="frame"><%=Day(DateSerial(Year(Now),Mes,i))%></font></a></font></TD>
    <%
   
    'RSAgenda.MoveNext
    'Wend
  end if
  Elseif (i<1) or (i > Day(UltimoDiaMes)) Then
  sql = "SELECT * FROM AGENDA WHERE day(dt_evento)="&i&" AND month(dt_evento)="&mes&" AND year(dt_evento)="&ano&""
      Set RSAgenda = conexao.execute(sql)
    If RSAgenda.EOF then%>
	<TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=gray><%=Day(DateSerial(Year(Now),Mes,i))%></TD>
  <%else
   'While NOT RSAgenda.EOF%>
   <TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=gray><B><a href="cagenda.asp?dt=<%=RSagenda("dt_evento")%>&mes=<%=Mes%>" target="frame"><%=Day(DateSerial(Year(Now),Mes,i))%></B></a></B></TD>
    <%'RSAgenda.MoveNext
    'Wend
  end if 
  
  Else
  sql = "SELECT * FROM AGENDA WHERE day(dt_evento)="&i&" AND month(dt_evento)="&mes&" AND year(dt_evento)="&ano&""
      Set RSAgenda = conexao.execute(sql)
    If RSAgenda.EOF then%>
	<TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=gray><%=Day(DateSerial(Year(Now),Mes,i))%></TD>
	<% else 
	'While NOT RSAgenda.EOF%>
	<TD align= center width=5 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=blue><a href="cagenda.asp?dt=<%=RSagenda("dt_evento")%>&mes=<%=Mes%>" target="frame"><b><%=Day(DateSerial(Year(Now),Mes,i))%></b></a></TD>

   <%'RSAgenda.MoveNext
    'Wend
    end if 

	End if

  If j = 7 then
     J = 0
  Response.Write "</tr>" %>
  <TR bgcolor="#FFFFFF">
  <% end if
  J = j + 1


Next 


FechaConexao
%>
      </TR>
</table>
  </tr>
  <tr>
    <td width="156">
      <div align="center">
        <center>
   <Table>

	<TR>
<TD NOWRAP COLSPAN=4 ALIGN=CENTER BGCOLOR=#FFFFFF>
	<TABLE CELLSPACING=0 CELLPADDING=1 BORDER=0>
	<TR>
  <TD>
<a HREF="<%=URL&"?mes="&(mes-1)%>" target="_self"><img src="seta_tras.gif" border="0" alt=""></a>
  </TD>
  <TD NOWRAP VALIGN=middle>
  	<TT><B><img src="seta_meio.gif" border="0" alt=""></B></TT>
  </TD>
  <TD>
<a HREF="<%=URL&"?mes="&(mes+1)%>" target="_self"><img src="seta_frente.gif" border="0" alt=""></a>
  </TD>
	</TR>
	</TABLE>
</TD>
</TR>
     
        </Table>
        </center>
      </div>
  </tr>
</table>
  </center>
  </div>
    </table>
</BODY>

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Da uma olhada se é isso q você quer??

<%Option Explicit%>

<HTML>

<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<TITLE>Calendário</TITLE>

<META NAME="Generator" CONTENT="Microsoft FrontPage 4.0">

<META NAME="Author" CONTENT="Alexandre Sales Lima">

<META NAME="Keywords" CONTENT="Calendario">

<META NAME="Description" CONTENT="Calendario escrito em ASP">

<base target="frame">

</HEAD>

<BODY bgcolor=#ffffff>

<%

'Lógica para construir o calendário

Session.LCID = 1046 'BRASIL

Dim URL,Dia, Mes, Ano, Agora, PrimeiroDiaMes, UltimoDiaMes, Mes2,Varmes

Dim Inicio,Fim, Start, TheEnd,i, j

URL= Request.ServerVAriables("SCRIPT_NAME")

if (Request.QueryString("Mes") <> Month(now))AND(Request.QueryString("Mes") <> "") Then

Mes=CInt(Request.QueryString("Mes"))'força que o resultado seja um inteiro

'mes2 = CInt(Month(date))

Select Case Mes

Case 1

varmes = "mes" & mes & ".jpg"

Case 2

varmes = "mes" & mes & ".jpg"

Case 3

varmes = "mes" & mes & ".jpg"

Case 4

varmes = "mes" & mes & ".jpg"

Case 5

varmes = "mes" & mes & ".jpg"

Case 6

varmes =  "mes" & mes & ".jpg"

Case 7

varmes = "mes" & mes & ".jpg"

Case 8

varmes = "mes" & mes & ".jpg"

Case 9

varmes = "mes" & mes & ".jpg"

Case 10

varmes = "mes" & mes & ".jpg"

Case 11

varmes = "mes" & mes & ".jpg"

Case 12

varmes = "mes" & mes & ".jpg"

End Select

else

Mes = Month(now)

mes2 = CInt(Month(date))

Select Case Mes

Case 1

varmes = "mes" & mes & ".jpg"

Case 2

varmes = "mes" & mes & ".jpg"

Case 3

varmes = "mes" & mes & ".jpg"

Case 4

varmes = "mes" & mes & ".jpg"

Case 5

varmes = "mes" & mes & ".jpg"

Case 6

varmes =  "mes" & mes & ".jpg"

Case 7

varmes = "mes" & mes & ".jpg"

Case 8

varmes = "mes" & mes & ".jpg"

Case 9

varmes = "mes" & mes & ".jpg"

Case 10

varmes = "mes" & mes & ".jpg"

Case 11

varmes = "mes" & mes & ".jpg"

Case 12

varmes = "mes" & mes & ".jpg"

End Select

end if

Dia=Day(now)

Ano = Year(now)

Agora = DateSerial(Ano, mes, dia)

PrimeiroDiaMes=DateSerial(Year(Now),Mes,1)

UltimoDiaMes=DateSerial(Year(Now),Mes+1,1-1)

Inicio = ABS(1 - WeekDay(PrimeiroDiaMes))

Fim = 7 - WeekDay(UltimoDiaMes)

Start=1-Inicio

TheEnd = Day(UltimoDiaMes) + Fim

J=1

'#############################################################

'# Inicio do meu código - Q Santa Luzia Ilumine meus olhinhos#

'#############################################################

%>

<!--#include file="conecta.asp"-->

<TABLE BORDER=0 WIDTH=194 CELLPADDING=0 ALIGN=left>

<TR>

<TD WIDTH="199" VALIGN=top style="border-style: solid; border-width: 1">

<div align="center">

<center>

<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="120">

<TR bgcolor=white>

<TD align="Center" width="195">

      <center><script>printDate();</script></center>

        </TD>

</TR>

<TR bgcolor=white>

<TD align="Center" width="195">

<TABLE  CELLSPACING=3 CELLPADDING=1 BORDER=0>

<TR>

  <TD COLSPAN=1 align="center" width="75"><img border="0" src="<%varmes%>"></TD>

</TR>

</Table>

        </TD>

</TR>

<tr>

<TD align="Center" width="195">

<TABLE  CELLSPACING=3 CELLPADDING=1 BORDER=0 width="99">

<TR bgcolor="#ffffff">

<%

AbreConexao

Dim sql, RSAgenda

For i= Start to TheEnd 

if (i = day(now)) And (Mes=Month(now)) Then

    sql = "SELECT * FROM AGENDA WHERE day(dt_evento)="&i&" AND month(dt_evento)="&mes&" AND year(dt_evento)="&ano&""

    Set RSAgenda = conexao.execute(sql)

  If RSAgenda.EOF then%>

<TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=black><b><%=Day(DateSerial(Year(Now),Mes,i))%></b></font></TD>

  <% else

  'While NOT RSAgenda.EOF%>

    <TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=red><a href="cagenda.asp?dt=<%=RSagenda("dt_evento")%>&mes=<%=Mes%>" target="frame"><%=Day(DateSerial(Year(Now),Mes,i))%></font></a></font></TD>

  <%

 

  'RSAgenda.MoveNext

  'Wend

end if

Elseif (i<1) or (i > Day(UltimoDiaMes)) Then

sql = "SELECT * FROM AGENDA WHERE day(dt_evento)="&i&" AND month(dt_evento)="&mes&" AND year(dt_evento)="&ano&""

    Set RSAgenda = conexao.execute(sql)

  If RSAgenda.EOF then%>

<TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=gray><%=Day(DateSerial(Year(Now),Mes,i))%></TD>

<%else

  'While NOT RSAgenda.EOF%>

  <TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=gray><B><a href="cagenda.asp?dt=<%=RSagenda("dt_evento")%>&mes=<%=Mes%>" target="frame"><%=Day(DateSerial(Year(Now),Mes,i))%></B></a></B></TD>

  <%'RSAgenda.MoveNext

  'Wend

end if

Else

sql = "SELECT * FROM AGENDA WHERE day(dt_evento)="&i&" AND month(dt_evento)="&mes&" AND year(dt_evento)="&ano&""

    Set RSAgenda = conexao.execute(sql)

  If RSAgenda.EOF then%>

<TD align= center width=1 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=gray><%=Day(DateSerial(Year(Now),Mes,i))%></TD>

<% else

'While NOT RSAgenda.EOF%>

<TD align= center width=5 style="border-style: solid; border-width: 1"><FONT face=Arial,Helvetica size=-1 COLOR=blue><a href="cagenda.asp?dt=<%=RSagenda("dt_evento")%>&mes=<%=Mes%>" target="frame"><b><%=Day(DateSerial(Year(Now),Mes,i))%></b></a></TD>

  <%'RSAgenda.MoveNext

  'Wend

  end if

End if

If j = 7 then

    J = 0

Response.Write "</tr>" %>

<TR bgcolor="#FFFFFF">

<% end if

J = j + 1

Next

FechaConexao

%>

    </TR>

</table>

</tr>

<tr>

  <td width="156">

    <div align="center">

      <center>

  <Table>

<TR>

<TD NOWRAP COLSPAN=4 ALIGN=CENTER BGCOLOR=#FFFFFF>

<TABLE CELLSPACING=0 CELLPADDING=1 BORDER=0>

<TR>

<TD>

<a HREF="<%=URL&"?mes="&(mes-1)%>" target="_self"><img src="seta_tras.gif" border="0" alt=""></a>

</TD>

<TD NOWRAP VALIGN=middle>

  <TT><B><img src="seta_meio.gif" border="0" alt=""></B></TT>

</TD>

<TD>

<a HREF="<%=URL&"?mes="&(mes+1)%>" target="_self"><img src="seta_frente.gif" border="0" alt=""></a>

</TD>

</TR>

</TABLE>

</TD>

</TR>

   

      </Table>

      </center>

    </div>

</tr>

</table>

</center>

</div>

  </table>

</BODY>

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...