Tips.cl

Tag: lectura

Lectura de cookie en JavaScript

by MigueliTUX on Sep.15, 2009, under JavaScript

Lectura de cookie en JavaScript

// Lectura de cookie
function readCookie(name)
{
  var ca = document.cookie.split(';');
 
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
 
    }
  return null;
}

gentileza de @NelsonCuevas

fuente http://www.yourhtmlsource.com/javascript/cookies.html

4 Comentarios :, , más...

Buscas algun tips?

Busca aquí:

contactate con nosotos contacto@tips.cl

Visita nuestras Web amigas!

Web Amigas...