The following is the regular method I use to get cookies, including single value and multi-value:
/************************************************
Parameter description:
sMainName Cookie name
sSubName Cookie subkey name, leave blank to indicate single value Cookie
************************ ****************************/
function GetCookie(sMainName, sSubName)
{
var re = new RegExp(sMainName (sSubName ? "=" sSubName : "") "= (.*?);", "i");
return re.test(unescape(document.cookie)) ? RegExp["$1"] : "";
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn