Posted By

Piotrek290 on 10/24/09


Tagged

js cookie


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

nerdfiles


Cookie


 / Published in: JavaScript
 

URL: http://dealis.pl/projects,cookie.html

  1. /*
  2. Author: Piotr Filipek
  3. Website: www.dealis.pl
  4. Version 0.1
  5. E-mail: [email protected]
  6. */
  7.  
  8. var Cookie = {
  9. 'create':function(a1,a2,a3,a4){var c=typeof a4=='function'?a4:(new Function()),d,ex="";if(a3){d=new Date();d.setTime(d.getTime()+(a3*24*60*60*1000));ex="; expires="+d.toGMTString();c(a1,a2);};document.cookie = a1+"="+a2+ex+"; path=/";return this;},
  10. 'read':function(a1){var c=typeof a4=='function'?a4:(new Function()),n=a1+"=",ca=document.cookie.split(';'),c;for(var i=0;i < ca.length;i++){c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(n) == 0)return c.substring(n.length,c.length);}},
  11. 'delete':function(a1,a2){Cookie.create(a1,'',-1,a2);}
  12. };

Report this snippet  

You need to login to post a comment.