SHARE
TWEET

getCookie function

a guest Dec 15th, 2011 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getCookie(cookieName) {
  2.         var cookiePattern = new RegExp('(^|;)[ ]*' + cookieName + '=([^;]*)'),
  3.                 cookieMatch = cookiePattern.exec(document.cookie);
  4.                 if(cookieMatch){
  5.                         return cookieMatch[2];
  6.                 }
  7.                 return 0;
  8. };
RAW Paste Data
Want to get better at JavaScript?
Learn to code JavaScript in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top