var JzCookie = { //cookie操作 Set: function (name, value, expireDays, domain, isRoot) { // 设置 名称 值 过期天数 主域名 是否根路径 var dm = '', ed = '', ir = ''; if (expireDays) { var d = new Date(); d.setTime(d.getTime() + (expireDays * 24 * 60 * 60 * 1000)); ed = ";expires=" + d.toUTCString(); if (domain) dm = ";domain=" + domain; if (isRoot) ir = ";path=/"; } document.cookie = name + "=" + escape(value) + dm + ed + ir; }, Get: function (name) { // 获取 var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); return (arr = document.cookie.match(reg)) ? arr[2] : null; }, Remove: function (name, domain, isRoot) { // 清除 JzCookie.Set(name, '', -1, domain, isRoot); } };