SORU
28 Ocak 2011, Cuma


Nasıl ve çerez değeri oluşturun okuyabilirim?

Nasıl ve JavaScript çerez değeri oluşturun okuyabilirim?

CEVAP
28 Ocak 2011, Cuma


Burada ve çerez oluşturma almak için kullanabileceğiniz fonksiyonlar.

var createCookie = function(name, value, days) {
    var expires;
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()   (days * 24 * 60 * 60 * 1000));
        expires = "; expires="   date.toGMTString();
    }
    else {
        expires = "";
    }
    document.cookie = name   "="   value   expires   "; path=/";
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name   "=");
        if (c_start != -1) {
            c_start = c_start   c_name.length   1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Dylan Dubay

    Dylan Dubay

    10 Temmuz 2013
  • Good Creative Academy

    Good Creativ

    19 Kasım 2009
  • jkimisyellow...ish

    jkimisyellow

    8 Temmuz 2009