Posted By

damarev on 11/26/06


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

miziomon
vali29


getCookie


 / Published in: JavaScript
 

  1. function getCookie( name ) {
  2. var start = document.cookie.indexOf( name + "=" );
  3. var len = start + name.length + 1;
  4. if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
  5. return null;
  6. }
  7. if ( start == -1 ) return null;
  8. var end = document.cookie.indexOf( ';', len );
  9. if ( end == -1 ) end = document.cookie.length;
  10. return unescape( document.cookie.substring( len, end ) );
  11. }

Report this snippet  

You need to login to post a comment.