Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Problema con NS6 e 7

  1. #1

    Problema con NS6 e 7

    Ciao a tutti!
    Sto sperimentando un menù che mi permetta di visualizzare cose diverse evitando ilayer e frame...
    ma non riesco a far funzionare il codice anche per netscape 6 e 7...
    (lo vedo con la versione 4!)

    Qui potete vedere l'esempio

    i file sono: doc.html common.js stile.css



    Mi sa che non so usare il DOM :-(

    Help me please!

  2. #2
    Nessuno?
    Questo è lo script usato, ma come noterete manca il pezzo per i browser di nuova generazione
    NN = (navigator.appName.indexOf("Netscape")>-1) ? 1 : 0;
    NN4 = (NN && parseInt(navigator.appVersion)==4) ? 1 : 0;

    var totalLayersInLoop=8;
    var layerNumShowing=1;

    function init(){
    if (NN4) {
    layerStyleRef="layer.";
    layerRef="document.layers";
    styleSwitch="";
    } else {
    layerStyleRef="layer.style.";
    layerRef="document.all";
    styleSwitch=".style";
    }
    }

    function showLayerNumber(number){
    var layerNumToShow=number;
    hideLayer(eval('"layer' + layerNumShowing+'"'));
    showLayer(eval('"layer' + layerNumToShow+'"'));
    layerNumShowing=layerNumToShow;
    }

    function showLayer(layerName){
    eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
    }

    function hideLayer(layerName){
    eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
    }
    Qualcuno può aiutarmi pleaseeeeeeeee!

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    633
    il codice per i browser DOM 1 W3C compatibili è:

    document.getElementById("attributo_ID")

    da usare (+ o -) come document.all per Explorer.
    ciauz
    Alcuni miei articoli in PRO.HTML.IT: JavaScript | DHTML | DOM
    Sviluppo : wedev | forum

  4. #4
    Ho cambiato il codice come sotto riportato, ma continua a non funzionare :-/
    NN = (navigator.appName.indexOf("Netscape")>-1) ? 1 : 0;
    NN4 = (NN && parseInt(navigator.appVersion)==4) ? 1 : 0;
    NN6 = (NN && parseInt(navigator.appVersion)>4) ? 1 : 0;

    var totalLayersInLoop=8;
    var layerNumShowing=1;

    function init(){
    if (NN4) {
    layerStyleRef="layer.";
    layerRef="document.layers";
    styleSwitch="";
    } else if (NN6) {
    layerStyleRef="layer.style.";
    layerRef="document.getElementById";
    styleSwitch=".style";
    } else {
    layerStyleRef="layer.style.";
    layerRef="document.all";
    styleSwitch=".style";
    }
    }

    function showLayerNumber(number){
    var layerNumToShow=number;
    hideLayer(eval('"layer' + layerNumShowing+'"'));
    showLayer(eval('"layer' + layerNumToShow+'"'));
    layerNumShowing=layerNumToShow;
    }

    function showLayer(layerName){
    eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
    }

    function hideLayer(layerName){
    eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
    }

  5. #5
    Risoltoooooooo!
    Ora funziona :tongue:

    javascript :
    NN = (navigator.appName.indexOf("Netscape")>-1) ? 1 : 0;
    NN4 = (NN && parseInt(navigator.appVersion)==4) ? 1 : 0;
    NN6 = (NN && parseInt(navigator.appVersion)>4) ? 1 : 0;

    /*cambiare questo numero al cambiare dei livelli da mostrare */
    var totalLayersInLoop=8;
    var layerNumShowing=1;

    function init(){
    if (NN4) {
    layerStyleRef="layer.";
    layerRef="document.layers";
    styleSwitch="";
    } else if (NN6) {
    layerStyleRef="layer.style.";
    layerRef="document.getElementById";
    styleSwitch=".style";
    } else {
    layerStyleRef="layer.style.";
    layerRef="document.all";
    styleSwitch=".style";
    }
    }

    function showLayerNumber(number){
    var layerNumToShow=number;
    hideLayer(eval('"layer' + layerNumShowing+'"'));
    showLayer(eval('"layer' + layerNumToShow+'"'));
    layerNumShowing=layerNumToShow;
    }

    function showLayer(layerName){
    if (NN6) {
    eval(layerRef+'("'+layerName+'")'+styleSwitch+'.vi sibility="visible"');
    } else {
    eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
    }
    }

    function hideLayer(layerName){
    if (NN6) {
    eval(layerRef+'("'+layerName+'")'+styleSwitch+'.vi sibility="hidden"');
    } else {
    eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
    }
    }
    Richiamo nella pagina html:

    <div class="menu">
    News top
    News t1
    etc... fino al numero di livelli neccessari
    </div>
    spazio che richiama i msg dei livelli da mostrare:

    <DIV ID="layer1" >


    messaggio da mostrare uno</p>
    </DIV>
    <DIV ID="layer2" >


    messaggio da mostrare 2</p>
    </DIV>
    etc...
    stile relativo ai livelli da mostrare (un id x ogni livello):
    #layer1 {POSITION:absolute; Z-INDEX:10; VISIBILITY:visible;
    LEFT:150px; TOP:100px; width:450px; height:400px;
    background-color : transparent; layer-background-color : trasparent;}

    #layer2 {POSITION:absolute; Z-INDEX:20; VISIBILITY:hidden;
    LEFT:150px; TOP:100px; width:450px; height:400px;
    background-color:#AAD5FF; layer-background-color:#AAD5FF;}

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.