cookie设置过期时间要先获取当前的时间日期再加上过期时间就行。如:
var oDate=new Date();
oDate.setDate(oDate.getDate()+7); //设置过期时间
document.cookie='user=admin;password=123546;expires='+oDate;
cookie设置过期时间要先获取当前的时间日期再加上过期时间就行。如:
var oDate=new Date();
oDate.setDate(oDate.getDate()+7); //设置过期时间
document.cookie='user=admin;password=123546;expires='+oDate;
转载于:https://www.cnblogs.com/52css/archive/2013/04/23/3037382.html