Cookie Retrieving Named Value (Javascript)
:
Return to List
// getCookie retrieves data from the named cookie
function getCookie(cName)
{
if (cName)
{
cookieArray = split(";",document.cookie);
for (i=0; i<cookieArray.length; i++)
{
thisCookie = cookieArray[i];
if (thisCookie.indexOf(cName+"=") > -1)
{
var valueLoc = thisCookie.indexOf("=")+1;
cookieValue = thisCookie.substring(valueLoc, thisCookie.length);
return unescape(cookieValue);
}
}
}
return false;
}
Note to Webmaster