Visualizzazione risultati 1 fino 3 di 3

Discussione: [JavaScript/HTML] Multiplo div nascondi/mostra

  1. #1
    Guest

    Post [JavaScript/HTML] Multiplo div nascondi/mostra

    Ciao a tutti, ho trovato questo script e lo vorrei adattare alle mie esigenze:
    Codice PHP:
    <html>
    <
    head>
    <
    title>boh</title>
    <
    script language="javascript">
    <!--
    var
    state = 'none';
    function
    showhide(layer_ref) {
    if (
    state == 'block') {
    state = 'none';
    }
    else {
    state = 'block';
    }
    if (
    document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.display = state");
    }
    if (
    document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].display = state;
    }
    if (
    document.getElementById &&!document.all) {
    hza = document.getElementById(layer_ref);
    hza.style.display = state;
    }
    }
    //-->
    </script>
    </head>
    <body>
    <h1><a href="#" onclick="showhide('tutorial_1');">Titolo tutorial 1</a></h1>
    <div id="div1" style="display: none;">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</div>
    <h1><a href="#" onclick="showhide('tutorial_2');">Titolo tutorial 2</a></h1>
    <div id="div1" style="display: none;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
    <h1><a href="#" onclick="showhide('tutorial_3');">Titolo tutorial 3</a></h1>
    <div id="div1" style="display: none;">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32</div>
    </body>
    </html>
    Il problema e che io voglio multipli div es. tutorial_1, tutorial_2, tutorial_(numero)... sapete dirmi come fare? Grazie 1000...ciao Davide! ^^
    PS. Ho fatto una ricerca ma niente!
    Ultima modifica di sIM : 12-02-2009 alle ore 20.09.21

  2. #2
    L'avatar di miki92
    miki92 non è connesso AlterGuru 2500
    Data registrazione
    21-04-2007
    Residenza
    Procida (NA)
    Messaggi
    4,226

    Predefinito

    Cioè? Non ho capito cosa c'è che non va?

    Cioè oltre questo:
    Codice HTML:
    <h1><a href="#" onclick="showhide('tutorial_1');">Titolo tutorial 1</a></h1>
    <div id="div1" style="display: none;">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</div> 
    <h1><a href="#" onclick="showhide('tutorial_2');">Titolo tutorial 2</a></h1>
    <div id="div1" style="display: none;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div> 
    <h1><a href="#" onclick="showhide('tutorial_3');">Titolo tutorial 3</a></h1>
    <div id="div1" style="display: none;">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32</div>
    Che dovrebbe essere:
    Codice HTML:
    <h1><a href="#" onclick="showhide('tutorial_1');">Titolo tutorial 1</a></h1>
    <div id="tutorial_1" style="display: none;">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</div> 
    <h1><a href="#" onclick="showhide('tutorial_2');">Titolo tutorial 2</a></h1>
    <div id="tutorial_2" style="display: none;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div> 
    <h1><a href="#" onclick="showhide('tutorial_3');">Titolo tutorial 3</a></h1>
    <div id="tutorial_3" style="display: none;">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32</div>
    Non vedo nulla di errato...ti puoi spiegare meglio?
    Apprezzi l'aiuto? Offrimi un caffè!

  3. #3
    Guest

    Predefinito

    Oooops... ^^''
    Ciao e Grazie! ^_______^

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •