Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Menu Javascript e Link

  1. #1

    Menu Javascript e Link

    Salve,
    ho un menù a tendina javascript. La mia pagina è impostata con un frame superiore e uno sottostante.
    Nella pagina sotto è presente il menù javascript che si ripete (mediante un modello in Dreamweaver) su tutte le pagine.
    Dalla prima voce del menu si accede al primo link. Le pagine di questo link sono in una directory.
    Navigo il link e quando clicco sulla voce di menù per tornare alla prima pagina il sito va in errore rimettendo nel path del link 2 volte il nome della directory.....
    chi mi aiuta? Nn vorrei togliere le pagine .html dalla directory (unico modo per far funzionare il sito)...........perchè sono molte ed è bene che siano organizzate in cartelle..........

    mi sono spiegata?????


    @rianna

    "Si usa uno specchio di vetro per guardare il viso e si usano le opere d'arte
    per guardare la propria anima"(George Bernard Shaw)
    http://www.ariannaweb.net
    http://www.fraschette.com
    http://www.ilmondodibiagio.it

  2. #2
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    6,034
    provato con i percorsi assoluti (http) ? dove l'hai preso?

  3. #3

    ....risposta

    si tratta di una demo di un prodotto...ho scritto "sito" ma non può essere trattato come tale....quindi niente link assoluti dato che non abdrà sul web ma sarà visionabile da pc




    questo è il menù .js
    ************************************************** ********************
    if (document.all) {n=0;ie=1;fShow="visible";fHide="hidden";}
    if (document.layers) {n=1;ie=0;fShow="show"; fHide="hide";}

    window.onerror=new Function("return true")
    ////////////////////////////////////////////////////////////////////////////
    // Function Menu() //
    ////////////////////////////////////////////////////////////////////////////
    rightX = 0;
    function Menu()
    {
    this.bgColor = "#005490";
    if (ie) this.menuFont = "bold xx-small Verdana";
    if (n) this.menuFont = "bold x-small Verdana";
    // this.fontColor = "white";

    this.addItem = addItem;
    this.addSubItem = addSubItem;
    this.showMenu = showMenu;
    this.mainPaneBorder = 1;
    this.subMenuPaneBorder = 1;

    this.subMenuPaneWidth = 150;

    lastMenu = null;

    rightY = 0;
    leftY = 0;
    leftX = 0;

    HTMLstr = "";
    HTMLstr += "\n";
    HTMLstr += "\n";
    if (ie) HTMLstr += "<div id='MainTable' style='position:relative'>\n";
    // if (n) HTMLstr += "<layer name='MainTable'>\n";
    HTMLstr += "<table width='100%' bgcolor='"+this.bgColor+"' border='"+this.mainPaneBorder+"'>\n";
    HTMLstr += "<tr>";
    if (n) HTMLstr += "<td>";
    HTMLstr += "\n";
    HTMLstr += "\n";
    HTMLstr += "\n";
    if (n) HTMLstr += "</td>";
    HTMLstr += "</tr>\n";
    HTMLstr += "</table>\n";
    HTMLstr += "\n";
    HTMLstr += "\n";
    HTMLstr += "\n";
    HTMLstr += "\n";
    HTMLstr += "\n";
    if (ie) HTMLstr+= "</div>\n";
    // if (n) HTMLstr+= "</layer>\n";
    HTMLstr += "\n";
    }

    function addItem(idItem, text, hint, location, altLocation)
    {
    var Lookup = "";
    if (HTMLstr.indexOf(Lookup) != -1)
    {
    alert(idParent + " already exist");
    return;
    }
    var MENUitem = "";
    MENUitem += "\n\n";
    if (n)
    {
    MENUitem += "<ilayer name="+idItem+">";
    MENUitem += "<a href='.' class=clsMenuItemNS onmouseover=\"displaySubMenu('"+idItem+"')\" onclick=\"return false;\">";
    MENUitem += "|";
    MENUitem += text;
    MENUitem += "</a>";
    MENUitem += "</ilayer>";
    }
    if (ie)
    {
    MENUitem += "<td>\n";
    MENUitem += "<div id='"+idItem+"' style='position:relative; font: "+this.menuFont+";'>\n";
    MENUitem += "<a ";
    MENUitem += "class=clsMenuItemIE ";
    // MENUitem += "style='text-decoration: none; font: "+this.menuFont+"; color: "+this.fontColor+"; cursor: hand;' ";
    if (hint != null)
    MENUitem += "title='"+hint+"' ";
    if (location != null)
    {
    MENUitem += "href='"+location+"' ";
    MENUitem += "onmouseover=\"hideAll()\" ";
    }
    else
    {
    if (altLocation != null)
    MENUitem += "href='"+altLocation+"' ";
    else
    MENUitem += "href='.' ";
    MENUitem += "onmouseover=\"displaySubMenu('"+idItem+"')\" ";
    MENUitem += "onclick=\"return false;\" "
    }
    MENUitem += ">";
    MENUitem += "|\n";
    MENUitem += text;
    MENUitem += "</a>\n";
    MENUitem += "</div>\n";
    MENUitem += "</td>\n";
    }
    MENUitem += "\n\n";
    MENUitem += "\n";

    HTMLstr = HTMLstr.replace("\n", MENUitem);
    }

    function addSubItem(idParent, text, hint, location)
    {
    var MENUitem = "";
    Lookup = "";
    if (HTMLstr.indexOf(Lookup) == -1)
    {
    alert(idParent + " not found");
    return;
    }
    Lookup = "";
    if (HTMLstr.indexOf(Lookup) == -1)
    {
    if (n)
    {
    MENUitem += "\n";
    MENUitem += "<layer id='"+idParent+"submenu' visibility=hide bgcolor='"+this.bgColor+"'>\n";
    MENUitem += "<table border='"+this.subMenuPaneBorder+"' bgcolor='"+this.bgColor+"' width="+this.subMenuPaneWidth+">\n";
    MENUitem += "\n";
    MENUitem += "</table>\n";
    MENUitem += "</layer>\n";
    MENUitem += "\n";
    }
    if (ie)
    {
    MENUitem += "\n";
    MENUitem += "<div id='"+idParent+"submenu' style='position:absolute; visibility: hidden; width: "+this.subMenuPaneWidth+"; font: "+this.menuFont+"; top: -300;'>\n";
    MENUitem += "<table border='"+this.subMenuPaneBorder+"' bgcolor='"+this.bgColor+"' width="+this.subMenuPaneWidth+">\n";
    MENUitem += "\n";
    MENUitem += "</table>\n";
    MENUitem += "</div>\n";
    MENUitem += "\n";
    }
    MENUitem += "\n";
    HTMLstr = HTMLstr.replace("\n", MENUitem);
    }

    Lookup = "\n";
    if (n) MENUitem = "<tr><td>"+text+"
    </td></tr>\n";
    if (ie) MENUitem = "<tr><td>"+text+"
    </td></tr>\n";
    MENUitem += Lookup;
    HTMLstr = HTMLstr.replace(Lookup, MENUitem);

    }

    function showMenu()
    {
    document.writeln(HTMLstr);
    }

    ////////////////////////////////////////////////////////////////////////////
    // Private declaration
    function displaySubMenu(idMainMenu)
    {
    var menu;
    var submenu;
    if (n)
    {
    submenu = document.layers[idMainMenu+"submenu"];
    if (lastMenu != null && lastMenu != submenu) hideAll();
    submenu.left = document.layers[idMainMenu].pageX;
    submenu.top = document.layers[idMainMenu].pageY + 25;
    submenu.visibility = fShow;

    leftX = document.layers[idMainMenu+"submenu"].left;
    rightX = leftX + document.layers[idMainMenu+"submenu"].clip.width;
    leftY = document.layers[idMainMenu+"submenu"].top+
    document.layers[idMainMenu+"submenu"].clip.height;
    rightY = leftY;
    } else if (ie) {
    menu = eval(idMainMenu);
    submenu = eval(idMainMenu+"submenu.style");
    submenu.left = calculateSumOffset(menu, 'offsetLeft');
    // submenu.top = calculateSumOffset(menu, 'offsetTop') + 30;
    submenu.top = menu.style.top+23;
    submenu.visibility = fShow;
    if (lastMenu != null && lastMenu != submenu) hideAll();

    leftX = document.all[idMainMenu+"submenu"].style.posLeft;
    rightX = leftX + document.all[idMainMenu+"submenu"].offsetWidth;

    leftY = document.all[idMainMenu+"submenu"].style.posTop+
    document.all[idMainMenu+"submenu"].offsetHeight;
    rightY = leftY;
    }
    lastMenu = submenu;
    }

    function hideAll()
    {
    if (lastMenu != null) {lastMenu.visibility = fHide;lastMenu.left = 0;}
    }

    function calculateSumOffset(idItem, offsetName)
    {
    var totalOffset = 0;
    var item = eval('idItem');
    do
    {
    totalOffset += eval('item.'+offsetName);
    item = eval('item.offsetParent');
    } while (item != null);
    return totalOffset;
    }

    function updateIt(e)
    {
    if (ie)
    {
    var x = window.event.clientX;
    var y = window.event.clientY;

    if (x > rightX || x < leftX) hideAll();
    else if (y > rightY) hideAll();
    }
    if (n)
    {
    var x = e.pageX;
    var y = e.pageY;

    if (x > rightX || x < leftX) hideAll();
    else if (y > rightY) hideAll();
    }
    }

    if (document.all)
    {
    document.body.onclick=hideAll;
    document.body.onscroll=hideAll;
    document.body.onmousemove=updateIt;
    }
    if (document.layers)
    {
    document.onmousedown=hideAll;
    window.captureEvents(Event.MOUSEMOVE);
    window.onmousemove=updateIt;
    }
    ************************************************** ******************** questa la funzione che richiama i link

    function showToolbar()
    {
    // Voci principali(identificativo, voce del menù, testo alternativo nel fumetto, URL,URL alternativa);
    // Voci sottomenù(identificativo del menù, voce del sottomenù, testo alternativo nel fumetto, URL);

    menu = new Menu();
    menu.addItem("primomenuid", "Gruppi", "Questo è il primo menù", null, null);
    menu.addItem("secondomenuid", "Topografia", "Questo è il secondo menù", null, null);
    menu.addItem("terzomenuid", "Terzo Menù", "Questo è il terzo menù", null, null);
    menu.addItem("quartomenuid", "Quarto Menù", "Questo è il quarto menù", null, null);
    menu.addItem("quintomenuid", "Quinto Menù", "Questo è il quinto menù", null, null);

    menu.addSubItem("primomenuid", "Ricerca Gruppi", "Questo è il primo link", "Ricerca_Gruppi/RicercaGruppi.html");
    menu.addSubItem("primomenuid", "Secondo link", "Questo è il secondo link", "pagina_2.html");
    "Si usa uno specchio di vetro per guardare il viso e si usano le opere d'arte
    per guardare la propria anima"(George Bernard Shaw)
    http://www.ariannaweb.net
    http://www.fraschette.com
    http://www.ilmondodibiagio.it

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2000
    residenza
    Savona
    Messaggi
    897

    Forse forse...

    .. è solo un problema di percorso. Guarda sulla barra di stato il percorso: magari devi aggiungere ../nome_cartella/nomefile.html
    Non so dirtelo perchè non conosco come hai organizzato le cartelle. Spero di esserti stato un po' d'aiuto
    Ciao,
    dover

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.