Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Menu a 4 livelli (cosa strana)

    Ciao A tutto il forum

    sto facendo un menu a 4 livelli ma succede una cosa strana, il menu è così composto

    - foglio di stile
    - JavaScript (che riporto sotto)

    navHover = function() {
    var lis = document.getElementById("navmenu").getElementsByTa gName("LI");
    for (var i=0; i<lis.length; i++) {
    lis[i].onmouseover=function() {
    this.className+=" iehover";
    }
    lis[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" iehover\\b"), "");
    }
    }
    }
    if (window.attachEvent) window.attachEvent("onload", navHover);


    e il codice del menu:

    (la tabella Menu è sempre la stessa)

    <%
    apro tabella menu
    %>
    <ul id="navmenu">
    <%
    Do while not Menu.EOF
    IDMenu = Menu("IDMenu")
    if Menu("IDPadre") = 0 then
    %>
    [*]<%=Menu("voce")%>

    <%
    Dim apro, chiudo, IDMenu2
    apro tabella menu2 where IDPadre = " & IDMenu
    %>
    <%
    IF Menu2.EOF or Menu2.BOF then
    else
    apro = false
    Do while not Menu2.EOF
    IDMenu2 = Menu2("IDMenu")
    If apro = false Then
    %>
    <ul>
    <%
    apro = true
    end if
    %>

    [*]<%=Menu2("voce")%>
    <%
    Menu2.movenext
    loop
    %>

    <%
    Dim IDMenu3
    apro tabella menu3 where IDPadre = " & IDMenu2
    %>
    <%
    IF Menu3.EOF or Menu3.BOF then
    else
    apro = false
    Do while not Menu3.EOF
    IDMenu3 = Menu3("IDMenu")
    If apro = false Then
    %>
    <ul>
    <%
    apro = true
    end if
    %>

    [*]<%=Menu3("voce")%>
    <%
    Menu3.movenext
    loop
    %>

    <%
    apro tabella menu4 where IDPadre = " & IDMenu3
    %>
    <%
    IF Menu4.EOF or Menu4.BOF then
    else
    apro = false
    Do while not Menu4.EOF
    If apro = false Then
    %>
    <ul>
    <%
    apro = true
    end if
    %>[*]<%=Menu4("voce")%>
    <%
    Menu4.movenext
    loop
    %>[/list]
    <%
    end if
    Menu4.close()
    Set Menu4 = nothing
    %> [/list]
    <%
    end if
    Menu3.close()
    Set Menu3 = nothing
    %> [/list]
    <%
    end if
    Menu2.close()
    Set Menu2 = nothing
    end if
    Menu.movenext
    loop
    %>
    [/list]

    chiudo menu

    succede che pesca i vari sottomenu ...quando ne ha voglia ...quasi a caso

  2. #2
    Utente di HTML.it L'avatar di wegawhite
    Registrato dal
    Aug 2004
    Messaggi
    1,400
    Cambia tipo di menu, utilizza ad esempio questo fatto con i CSS:

    http://solardreamstudios.com/_img/le...dex-horiz.html

  3. #3
    Si wegawhite è proprio quello il tipo di menu che sto cercando di rendere dinamico a 4 livelli infatti ho scricate il css e il file js proprio dal link che tu hai postato

    Ma come ti dicevo succede una cosa strana, cioè che li pesca "quando vuole lui" ....sicuramente sto sbagliando io nel ciclo ma non riesco a vedere dove :master:

  4. #4
    ma scusa ogni menu ha una tabella?

  5. #5
    No nel DB è 1 unica tabella così strutturata:

    IDMenu ---- IDPadre ---- Voce

    Dove se IDPadre = zero, allora quella è una voce di primo livello

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.