Visualizzazione risultati 1 fino 2 di 2

Discussione: Come potere riciclare questo codice java nel migliore dei modi

  1. #1
    Guest

    Lightbulb Come potere riciclare questo codice java nel migliore dei modi

    ciao a tutti, guardate un pò questo codice:

    <SCRIPT LANGUAGE="JavaScript">

    <!--
    var username = GetCookie('username');
    var dom = GetCookie('MyDomain');

    if (username == null) {

    username = prompt('Scrivi il tuo nome',"");

    if (username == null) {

    alert('Se non scrivi il tuo nome, sarai Anonimo.');
    username = 'Anonimo';

    } else {

    pathname = location.pathname;
    MyDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';


    var largeExpDate = new Date ();
    largeExpDate.setTime(largeExpDate.getTime() + (365 * 24 * 3600 * 1000));

    SetCookie('username',username);
    }

    }

    function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
    }
    function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0)
    break;
    }
    return null;
    }

    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" : "");
    }

    document.write('<font face=arial size=4>Un grande benvenuto a '+username+' !</font> ');
    //-->
    </SCRIPT>

    </HEAD>

    <BODY bgcolor="white">



    </body>
    </html>

    mi permette per tanto di far si che ogni volta che uno entra nel mio sito, entri con un nick, e con un scritta di benvenuto.
    Io vorrei se possibile riciclare questo codice html per far si che io lo possa utilizzare per inserire all'interno del mio sito un spazio dove si possa vedere quanti di questi iscritti sono presenti all'interno del mio sito, e chi sono.

    Spero essere stato abbastanza chiaro.

    Aspetto un vostro suggerimento.


  2. #2
    Guest

    Predefinito

    ma nn c'é veramente nessuno che mi possa aiutare.

    rispondetemi grazie

Regole di scrittura

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