Menu ONCLICK
Olá pessoal ,
eu não to conseguindo fazer o meu menu GERENCIADO com menus filhos encolher .
exemplo :
--> Disciplinas
- portugues
- matematica
Ao clicar em DIsciplina , ele encole
--> Disciplinas
Ao clicar novamente , ele abre.
Bom, esse é o codigo , alguém me ajude
<!--#include file="../includes/config.asp"-->
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:#000000;
width:140px;
padding:2px;
text-align:center;
font-weight:bold;
///border:1px solid #000000;/ /
}
.submenu{
margin-bottom: 0.5em;
}
</style>
<script type="text/javascript">
/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar*.className=="submenu") //DynamicDrive.com change*
* ar**.style.display = "none";*
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
*function get_cookie(Name) { *
*var search = Name + "="*
*var returnvalue = "";*
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function onloadfunction(){
if (persistmenu=="yes"){
*var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname*
*var cookievalue=get_cookie(cookiename)*
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}
*function savemenustate(){*
*var inc=1, blockid=""*
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
*var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname*
*var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid*
document.cookie=cookiename+"="+cookievalue
}
if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction
if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
</script>
*<table width="165" border="0" cellspacing="0" cellpadding="0">*
*<tr>*
* <td><img src="../img/menuAfaculdade.jpg" width="165" height="31"></td>*
* </tr>*
<%
Function RetornalLinkMenu(Codigo, Conteudo)
Select Case Conteudo
Case "1"
RetornalLinkMenu = "agenda.asp?codigo=" & Codigo
Case "2"
RetornalLinkMenu = "formulario.asp?codigo=" & Codigo
Case "3"
RetornalLinkMenu = "noticias.asp?codigo=" & Codigo
Case "4"
RetornalLinkMenu = "galeria.asp?codigo=" & Codigo
Case "5"
RetornalLinkMenu = "conteudo.asp?codigo=" & Codigo
Case Else
RetornalLinkMenu = Empty
End Select
End Function
ComandoSQL = "select from menu where CodPai is null" *
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open ComandoSQL,Conn, 1, 2
While Not RS.EOF
%>
* <tr> *
* <td>*
* <table width="165" border="0" cellspacing="0" cellpadding="0">*
* <tr>*
* <td height="22" class="fundoMenu2"> <a href="noticias.asp" class="linkBranco"><%=rs("titulo")%> </a>*
* </td>*
<%
Set RS_titulo = Server.CreateObject("ADODB.Recordset")
sqlmenu = "select from menu where CodPai = '" & RS("Codigo") & "'"*
RS_titulo.Open sqlmenu,Conn, 1, 2
While not RS_titulo.EOF
%>
<tr>
<%
Link = RetornalLinkMenu(RS_titulo("CodSecao"), RS_titulo("CodConteudo"))
If Not isEmpty(Link) Then
%>
<td height="22"> - <a class="texto" href="<%=Link%>"><%=RS_titulo("Titulo")%></a></td>
<%
Else
%>
<td height="22"> - <span class="texto"><%=RS_titulo("Titulo")%></span></td>
<%
End If
%>
<td>
<%
Set RS_filho = Server.CreateObject("ADODB.Recordset")
sqlfilho = "select from menu where CodPai = '" & RS_titulo("Codigo") & "'"*
RS_filho.Open sqlfilho,Conn, 1, 2
While not RS_filho.EOF
%>
<tr>
<%
Link = RetornalLinkMenu(rs_filho("CodSecao"), rs_filho("CodConteudo"))
If Not isEmpty(Link) Then
%>
<td height="22"> - <a class="texto" href="<%=Link%>"><%=rs_filho("Titulo")%></a></td>
<%
Else
%>
<td height="22"> - <span class="texto"><%=rs_filho("Titulo")%></span></td>
<%
End If
%>
<td>
<%
RS_filho.MoveNext
Wend
RS_titulo.MoveNext
wend
%>
* </tr>*
* </table></td>*
* </tr>*
<%
rs.movenext
Wend
rs.Close
Set rs = Nothing
%>
* <tr> *
* <td><img src="../img/menuBiblioteca.jpg" width="165" height="50" border="0"></td>*
* </tr>*
* <tr> *
* <td><a href="agenda.asp"><img src="../img/menuEventos.jpg" width="165" height="50" border="0"></td>*
* </tr>*
* <tr> *
* <td><img src="../img/menuCentro.jpg" width="165" height="50" border="0"></td>*
* </tr>*
* <tr> *
* <td><a href="faleconosco.asp"><img src="../img/menuFaleconosco.jpg" width="165" height="51" border="0"></td>*
* </tr>*
* <tr> *
* <td><img src="../img/menuAlunoonline.jpg" width="165" height="52" border="0"></td>*
* </tr>*
* <tr> *
* <td><img src="../img/menuFinal.jpg" width="165" height="82"></td>*
* </tr>*
*</table>*
****
Discussão (6)
Carregando comentários...