wkylin
function setCookie(cookieName,cookieValue,nDays){
/* 当前日期 */
var today = new Date();
/* 过期时间 */
var expire = new Date();
/* 取默认时长 1天 */
if(nDays == null || nDays==0){
nDays =1;
}
/* 计算过期时间 */
exprie.setTime(today.getTime()+360000*24*nDays);
/* 设置Cookie值 */
document.cookie = cookieName + "="+escape(cookieValue)+";expires=" + exprie.toGMTString();
}


function readCookie(cookieName){
/* Cookie 字符串 */
var theCookie = " " + document.cookie;
/* 找到 cookieName 的位置 */
var ind= theCookie.indexOf(cookieName);
if(ind == -1 || cookieName == ""){
return "";
}
var inde = theCookie.indexOf(";",ind);
if(inde == -1){
inde= theCookie.length;
return unescape(hteCookie.substring(ind + cookieName.length +1,inde));
}
}

分类:

技术点:

相关文章:

  • 2021-12-21
  • 2021-12-19
  • 2021-10-04
  • 2022-02-12
  • 2021-07-29
  • 2022-01-27
猜你喜欢
  • 2021-12-19
  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2022-01-29
相关资源
相似解决方案