Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Pup up una volta sola

  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2000
    Messaggi
    151

    Pup up una volta sola

    Ciao a tutti :>

    Sto cercando di realizzare un pop up che si visualizzi solamente al primo caricamento della pagina, al successivo reload vorrei che il pop up non uscisse più.

    Ho pensato che un'idea interessante poteva esser l'utilizzo dell'ip, ma dovrei far passare i dati da una pagina all'altra e invece io voglio lavorare sempre sulla stessa pagina. Avete qualche idea? ciao e grazie (ho fatto il cerca ma ho trovato più che altro pop up con click o normali)

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2000
    Messaggi
    938
    Ciao


    Devi usare i cookie.




    <script language="javascript">
    <!--
    var nomecookie="esempio";
    function getCookieVal (offsetb) {
    var endstrb = document.cookie.indexOf (";", offsetb);
    if (endstrb == -1)
    endstrb = document.cookie.length;
    return unescape(document.cookie.substring(offsetb, endstrb));
    }
    function GetCookie (searchcookie) {
    var argb = searchcookie + "=";
    var alenb = argb.length;
    var clenb = document.cookie.length;
    var ib = 0;
    while (ib < clenb) {
    var jb = ib + alenb;
    if (document.cookie.substring(ib, jb) == argb)
    return getCookieVal (jb);
    ib = document.cookie.indexOf(" ", ib) + 1;
    if (ib == 0) break;
    }
    return null;
    }
    writecookie = GetCookie(nomecookie);
    if (writecookie=="" || writecookie==null){
    cookie="no"
    }
    else
    cookie="yes";
    if (cookie=="no"){
    var win=window.open('pagina.html','','width=220,height =220,scrollbars=no,top=200,left=200');
    }
    if (cookie=="no"){
    nomecookie = "esempio"
    pathname = location.pathname;
    myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
    var largeExpDate = new Date ();
    largeExpDate.setTime(largeExpDate.getTime()+(1 * 24 * 3600 * 1000));
    SetCookie(nomecookie,win,largeExpDate,myDomain);
    }
    function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
    }
    // -->
    </script>
    </head>



    Massimo

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.