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

Recurso de Exibir/Ocultar Cabeçalho


Xenofonte

Pergunta

Galera,

Tenho uma página em ASP que chama um cabeçalho. Esse cabeçalho tem um recurso de

Exibir/Ocultar, ou seja, a página já vem exibindo o cabeçalho e quando o usuário clica no

símbolo de '+' ao lado do cabeçalho, o mesmo oculta e fica um símbolo de '-'. Do mesmo modo,

quando o usuário clica no '-', o cabeçalho é exibido.

Mas acontece que a mesma página tem uma combo, e quando o usuário clica nessa combo, o evento

onchange chama para a mesma página para preencher uma varíavel com o valor da combo.

Assim, o que eu quero fazer é o seguinte, quando o usuário ocultar o cabeçalho, o mesmo

permanecer oculto independente de refresh na página ou não.

O que tá acontecendo aqui é que quando eu dou o refresh na página, escolhendo um valor na

combo o mesmo que antes estava oculta, volta a aparecer e eu não quero isso.

Pra ficar melhor entendido o que eu quero é:

Quando o usuário clicar para ocultar o cabeçalho, o mesmo ficar oculto até que seja clicado

para exibir.

Código do cabeçalho:

Response.Write "<input type= ""hidden"" name='flgImgX' id='flgImgX' value='Minus'>"
Response.Write "<img border='0' title='Ocultar Cabeçalho' 

style=""cursor:pointer;cursor:hand;"" align=right id='imgX' name='imgX' 

src='../lib/minus.gif' width='15' height='15' 

onclick=""java script:AmpliaDiminuiDiv('Mais');MudandoFlag();"">"
Response.Write "<br>"
Response.Write "<div name='Mais' id='Mais'>"
Funcões:
function AmpliaDiminuiDiv(id) {
    
    if(document.getElementById(id).style.display != 'none')    {
        document.getElementById(id).style.display='none';
    }
    else
    {
        document.getElementById(id).style.display='block';
    }
    
    if(document.getElementById("flgImgX").value == "Minus")    {
        document.getElementById("imgX").src='../lib/plus.gif';
        document.getElementById("flgImgX").value = "Plus";
        document.getElementById("ImgX").title = 'Exibir Cabeçalho';
    }
    else
    {
        document.getElementById("imgX").src='../lib/minus.gif';
        document.getElementById("flgImgX").value = "Minus";
        document.getElementById("ImgX").title = 'Ocultar Cabeçalho';
    }
}
function MudandoFlag() {
    if (document.getElementById("flgStatus").value == "Exibe") {
        document.getElementById("flgStatus").value = "Oculta";
    }
    else
    {
        document.getElementById("flgStatus").value = "Exibe";
    }
    
    alert(document.getElementById("flgStatus").value);

}
Aqui é o form:
<form method="post" id="frmDtAula" name="frmDtAula" target="_parent">
    <input type="hidden" name="dtaula" id="dtaula" value="<%=sDtAula%>">
    <input type="hidden" name="disc" id="disc" value="<%=sDisciplina%>">
    <input type="hidden" name="turma" id="turma" value="<%=sTurma%>">
    <input type="hidden" name="ano" id="ano" value="<%=sAno%>">
    <input type="hidden" name="semestre" id="semestre" value="<%=sSemestre%>">
    <input type="hidden" name="bOK" id="bOK" value="ok">
    <input type="hidden" name="sProva" id="sProva" value="<%=sProva%>">
    <input type="hidden" name="coment" id="coment">
    <input type="hidden" name="pcomentbanco" id="pcomentbanco" value="<%=pcomentbanco%>">
    <input type="hidden" name="flgStatus" id="flgStatus" value="Exibe">
    <%if Request.Form("bOK") <> "" then %>
            <script 

language="javascript">AmpliaDiminuiDivX('Mais',document.getElementById("flgStatus").value)</s

cript>
    <%end if%>
</form>
function AmpliaDiminuiDivX(id, pFlag) {
    alert(pFlag);
    if (pFlag != "Exibe") {
        document.getElementById(id).style.display='none';
        alert('1');
    }
    else
    {
        document.getElementById(id).style.display='block';
        alert('2');
    }
    
}
Página Completa:
Dim aRs, iTot, sSQL, iTot2, iCount, iCount2, sql
Dim sProva, sTurma, sDisciplina, sSemestre, sAno, sClassTr, pmsg, sDtAula
Dim oNotas, colnotas
dim valor 
Dim strSQL, arrRs, strUltNumChamada, permit
dim aRsFaculdade
dim aRsUnidade
dim bFlag

bFlag = False

Set oNotas = Server.CreateObject("DOLServer.clsNotas")

if Request.Form("bOK") = "" then
    sTurma = trim (Request.Form("turma"))
    sDisciplina = trim (Request.Form("disc"))
    sProva = trim (Request.Form("prova"))
    sSemestre = trim (Request.Form("semestre"))
    sAno = trim (Request.Form("ano"))
else
    sTurma = trim (Request.Form("turma"))
    sDisciplina = trim (Request.Form("disc"))
    sProva = trim (Request.Form("sProva"))
    sSemestre = trim (Request.Form("semestre"))
    sAno = trim (Request.Form("ano"))
    sDtAula = trim (Request.Form("dtaula"))
    bFlag = True
end if 
 'Consulta o Numero de Casas decimais usados na Disciplina
Dim aDisc
Dim sSqlDisc
Dim iTotDisc
Dim nCasasDec
dim discipConceito

If Application("Banco")= 1 Then
    sSqlDisc = "Select nvl(n_casas_dec,0) , nvl(n_casas_dec_media,0), grupo_nota " & _
               "From Ly_Disciplina " & _
               "Where disciplina = '" & sDisciplina & "'"
Else
    sSqlDisc = "Select isnull(n_casas_dec,0) , isnull(n_casas_dec_media,0), grupo_nota " & _
               "From Ly_Disciplina " & _
               "Where disciplina = '" & sDisciplina & "'"
End If
aDisc = getArr(sSqlDisc)
iTotDisc = getTotArr(aDisc)
nCasasDec = 0
discipConceito = false

If iTotDisc >= 0 Then
    nCasasDec = aDisc(0,0)
    'Verifica se a disciplina trabalha com conceitos
    if trim(aDisc(2,0)) <> "" then
      discipConceito = true
    else
      discipConceito = false
    end if
End If

'Verificar se existe último número de chamada
strSQL = " select ULT_NUM_CHAMADA from LY_TURMA " & _
                 " where TURMA = '"&sTurma&"' and DISCIPLINA = '"&sDisciplina&"' " & _
                 " and SEMESTRE = "&sSemestre&" and ANO = "&sAno&" "
arrRs = GetArr(strSQL)
strUltNumChamada = UCase(arrRs(0,0))



    if (onotas.Processamento2 (colnotas, sturma, sdisciplina, sano, ssemestre, pmsg,, 

Session("DOCENTE_LY"), Session("USER_SM")) = True) then
      if Application("Banco") = 1 then
      sSQL = "select c.nome as curso, b.nome as disciplina, a.turma, a.ano, " & _
      "  a.semestre, a.faculdade , a.dependência, f.nome_abrev, pl.id_reduzida, " & _
      "  a.unidade_responsavel " & _
      "  from ly_turma a, ly_disciplina b, ly_curso c, ly_faculdade f, ly_periodo_letivo pl " 

& _
      "  where a.turma = '" & sTurma & "' " & _
      "  and a.disciplina = '" & sDisciplina & "' " & _
      "  and a.disciplina = b.disciplina " & _
      "  and a.curso = c.curso (+) " & _
      "  and a.ano = " & sAno & " " & _
      "  and a.semestre = " & sSemestre & " " & _
      "  and a.faculdade = f.faculdade " & _
      "  and pl.ano=a.ano " & _
      "  and pl.periodo=a.semestre "
    else
      sSQL = "select c.nome as curso, b.nome as disciplina, a.turma, a.ano, " & _
      "  a.semestre, a.faculdade, a.dependência, f.nome_abrev, pl.id_reduzida, " & _
      "  a.unidade_responsavel " & _
      "  from ly_turma a, ly_disciplina b, ly_curso c, ly_faculdade f, ly_periodo_letivo pl " 

& _
      "  where a.turma = '" & sTurma & "' " & _ 
      "  and a.disciplina = '" & sDisciplina & "' " & _
      "  and a.disciplina = b.disciplina " & _
      "  and a.curso *= c.curso and " & _ 
      "  a.ano = " & sAno & " " & _
      "  and a.semestre = " & sSemestre & " " & _
      "  and a.faculdade = f.faculdade " & _
      "  and pl.ano=a.ano " & _
      "  and pl.periodo=a.semestre "      
    end if
aRs = GetArr(sSQL)
'#######################################
'    TABELA DE CABEÇALHO (fundo amarelo)
'#######################################

'--------------------------------
'obtem o nome da unidade Responsável
'--------------------------------
ssql = "select nome_abrev from ly_faculdade where faculdade='" & ars(9,0) & "'"
aRsUnidade = GetArr(sSQL)

'--------------------------------
'obtem o nome da unidade física
'--------------------------------
ssql = "select nome_abrev from ly_faculdade where faculdade='" & ars(5,0) & "'"
aRsFaculdade = GetArr(sSQL)

Response.Write "<input type= ""hidden"" name='flgImgX' id='flgImgX' value='Minus'>"
Response.Write "<img border='0' title='Ocultar Cabeçalho' 

style=""cursor:pointer;cursor:hand;"" align=right id='imgX' name='imgX' 

src='../lib/minus.gif' width='15' height='15' 

onclick=""java script:AmpliaDiminuiDiv('Mais');MudandoFlag();"">"
Response.Write "<br>"
Response.Write "<div name='Mais' id='Mais'>"
Response.Write "<table border=0 width=""100%"">"
Response.Write "<tr class=tr01t>"
if session("descricao_disciplina") <> "" then
    Response.Write "<td width=""50%"" class=font02 colspan=2 align=left> " & 

session("descricao_disciplina") & " : "  & sDisciplina & " - " & aRs(1, iCount) 
else
    Response.Write "<td width=""50%"" class=font02 colspan=2 align=left>Disciplina: "  & 

sDisciplina & " - " & aRs(1, iCount) 
end if
'====================================
' SUBDISCIPLINAS
'====================================
call ListaSubDisciplina(sDisciplina,"")
Response.Write "</td>"
Response.Write "<td width=""50%"" class=font02 align=left colspan=2 valign=top>Turma: " & 

aRs(2, iCount) &  "</td>"
Response.Write "</tr>"
Response.Write "<tr class=tr01t>"
Response.Write "<td width=""25%"" class=font02 align=left>Ano/Período:&nbsp;" & aRs(3, 

iCount) & "/"&aRs(4, iCount)&"</td>"

if not IsEmpty(aRsUnidade) then
    response.Write "<td width=""30%"" class=font02 align=left>Unidade Responsável: 

"&aRsUnidade(0, 0)&"</td>"
else
    response.Write "<td width=""30%"" class=font02>&nbsp;</td>"
end if

if not IsEmpty(aRsFaculdade) then
    response.Write "<td width=""30%"" class=font02 align=left>Unidade Física: 

"&aRsFaculdade(0, 0)&"</td>"
else
    response.Write "<td width=""30%"" class=font02>&nbsp;</td>"
end if

Response.Write "<td width=""15%"" class=font02 align=left>Sala:&nbsp;" & aRs(6, iCount) & 

"</td>"
Response.Write "</tr>"
Response.Write "<tr class=tr01t><td width=""100%"" colspan=4 class=font02 

align=left>Curso:&nbsp;" & aRs(0, iCount) & "</td></tr>"
Response.Write "</table>"
Response.Write "</div>"        
        
%>
<script LANGUAGE=javascript>
function foto(pessoa, nome){
      var janela;
      janela = 

window.open('MostraFoto.asp?pessoa='+pessoa+'&nome='+nome,'Foto','toolbar=no,location=no,dire

ctories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,menubar=no,width=200,height=200'

);
}

function ChamaDtAula(pDtAula,pDisciplina,pTurma,pAno,pSemestre,pComent,pValida){
    document.getElementById("dtaula").value = pDtAula;
    document.getElementById("disc").value = pDisciplina;
    document.getElementById("turma").value = pTurma;
    document.getElementById("ano").value = pAno;
    document.getElementById("semestre").value = pSemestre;
        
    if (pValida == "valida") {
        document.getElementById("coment").value = pComent;
        document.all.frmDtAula.action = "DolDiariodeClasse_posValid.asp";
    }
    else 
    {
        document.all.frmDtAula.action = "DOLDiariodeClasse2.asp";
    }
    document.forms['frmDtAula'].submit();
}

function limita(campo){
var tamanho = document.getElementById(campo).value.length;
var tex=document.getElementById(campo).value;
if (tamanho>=1999) {
    document.getElementById(campo).value=tex.substring(0,1999);
}
return true;
}

</script>
<%end if%>
<%
Function TRADUZA(pMsg)
   TRADUZA = pMsg
End Function

%>
<%
function MostraMsgBox (sMens, sURL)
  Response.Write "<script LANGUAGE=JavaScript>" & _
                             "self.alert('" & sMens & "');" & _
                             "self.location.href = '" & sURL & "';</SCRIPT>"
End function
%>
<%
'buscar data da aula
dim sSqlDtAula
dim rsBuscaDtAula
dim totBuscaDtAula
If Application("Banco")= 1 Then 'Oracle
    sSqlDtAula = " select agenda, To_Char(DATA,'dd/mm/yyyy') "
else 'SQL
    sSqlDtAula = " select agenda, Convert(varchar,DATA,103) "
end if

sSqlDtAula = sSqlDtAula & " from ly_agenda " & _
                          " where turma = '" & sTurma & "' " & _ 
                          " and disciplina = '"& sDisciplina &"' " & 

_
                          " and ano = "& sAno &" " & _
                          " and semestre = "& sSemestre &" " & _
                          " and num_func = '"& Session("CODIGO") &"' 

"    

rsBuscaDtAula = GetArr(sSqlDtAula)
totBuscaDtAula  = GetTotArr(rsBuscaDtAula)

if totBuscaDtAula = -1 then
    MostraMsgBox TRADUZA("Não há datas de aula para esta turma!"), 

"DOLDiariodeClasse.asp"
    response.end
end if
%>
    <table border="0" width="100%" align=center>
      <tr>
        <td width=100% colspan=2 class=font02><%= TRADUZA("Datas de Aula: ")%>
          <select name="sel_dtaula" tabindex = "19" 

onchange="java script:ChamaDtAula(this.value,'<%=sDisciplina%>','<%=sTurma%>','<%=sAno%>','<%=

sSemestre%>','','');" size="1">
             <%DIM cont%>
             <OPTION value="0"></Option> 
             <% For cont = 0 to totBuscaDtAula%>
                 <OPTION value="<%=rsBuscaDtAula(0,cont)%>" <%if not 

isempty(sDtAula) then%><%if cstr(rsBuscaDtAula(0,cont)) = cstr(sDtAula) then Response.Write " 

Selected" end if %><%end if%> ><%=rsBuscaDtAula(1,cont)%></Option> 
             <% Next %>
          </select>
        </td>
       </tr>
       <tr><td colspan=4>&nbsp;</td></tr>
     
 <%if bFlag = true and sDtAula <> "0" then
    'verificar se existe registro
    dim sSql2, pcomentbanco
    dim rsBusca
    dim totBusca
    sSql2 = " select comentarios " & _
                    " from ly_diario_eletronico " & _
                    " where turma = '" & sTurma & "' " & _ 
                    " and disciplina = '"& sDisciplina &"' " & _
                    " and ano = "& sAno &" " & _
                    " and semestre = "& sSemestre &" " & _
                    " and agenda = '"& sDtAula &"' " & _
                    " and aula = '1' "    

    rsBusca = GetArr(sSql2)
    totBusca  = GetTotArr(rsBusca)%>
    
    <tr class=tr01a>
    <td width=100% colspan=2 class=font02><%= TRADUZA("Comentário: ")%></td>
    </tr>
    
    <tr>
      <td width=50% class=font02>
    <%if totBusca > -1 then
        pcomentbanco = rsBusca(0,0)%>
        <textarea cols=50 rows=10 name="comentario" id="comentario" 

onkeyup="limita('comentario');"><%=rsBusca(0,0)%></textarea>
    <%else
        pcomentbanco = ""%>
        <textarea cols=50 rows=10  name="comentario" id="comentario" 

onkeyup="limita('comentario');"></textarea>
    <%end if%>
      </td>
    </tr>
    
<%end if%>
    </table>


<%if bFlag = true and sDtAula <> "0" then%>
<script type="text/javascript" src="animated_scroll.js"></script>
<div class="wrap">
    <p class="top"><a 

href="java script:ChamaDtAula('<%=sDtAula%>','<%=sDisciplina%>','<%=sTurma%>','<%=sAno%>','<%=

sSemestre%>',document.getElementById('comentario').value,'valida');">&nbsp;</a></p>
</div>

<style type="text/css">
    <!--
    .top {  width:150px; height:25px; margin:0; padding:0; center:10px; bottom:50px; 

position:fixed; }
    .top a { width:150px; height:120px; display:block; overflow:hidden; font-size:1px; 

text-indent:-200px; background:url("../images/confirmaralterações.gif") no-repeat; }
    -->
</style>
<%end if%>

<script language="javascript">
function AmpliaDiminuiDivX(id, pFlag) {
    alert(pFlag);
    if (pFlag != "Exibe") {
        document.getElementById(id).style.display='none';
        alert('1');
    }
    else
    {
        document.getElementById(id).style.display='block';
        alert('2');
    }
    
}

function MudandoFlag() {
    if (document.getElementById("flgStatus").value == "Exibe") {
        document.getElementById("flgStatus").value = "Oculta";
    }
    else
    {
        document.getElementById("flgStatus").value = "Exibe";
    }
    
    alert(document.getElementById("flgStatus").value);

}

</script>
<form method="post" id="frmDtAula" name="frmDtAula" target="_parent">
    <input type="hidden" name="dtaula" id="dtaula" value="<%=sDtAula%>">
    <input type="hidden" name="disc" id="disc" value="<%=sDisciplina%>">
    <input type="hidden" name="turma" id="turma" value="<%=sTurma%>">
    <input type="hidden" name="ano" id="ano" value="<%=sAno%>">
    <input type="hidden" name="semestre" id="semestre" value="<%=sSemestre%>">
    <input type="hidden" name="bOK" id="bOK" value="ok">
    <input type="hidden" name="sProva" id="sProva" value="<%=sProva%>">
    <input type="hidden" name="coment" id="coment">
    <input type="hidden" name="pcomentbanco" id="pcomentbanco" value="<%=pcomentbanco%>">
    <input type="hidden" name="flgStatus" id="flgStatus" value="Exibe">
    <%if Request.Form("bOK") <> "" then %>
            <script 

language="javascript">AmpliaDiminuiDivX('Mais',document.getElementById("flgStatus").value)</s

cript>
    <%end if%>
</form>

<%

Set oNotas = nothing

%>

Agradeço quem puder ajudar.

Deve ser alguma besteira, mas eu não estou conseguindo achar onde que é.

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

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...