文件名称:设置cooke和获取cooke的JS函数
文件大小:963B
文件格式:TXT
更新时间:2015-10-17 13:25:30
设置cooke 获取cooke的 函数
[removed] function setCookie(name, value, expires, path, domain, secure) { var today = new Date(); var expiry = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000); if(expires==''||expires==null) { expires=expiry; } var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); [removed] = curCookie; } function getCookie(name) { var dc = [removed]; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = [removed].indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } [removed]