cookie

cookie设置过期时间要先获取当前的时间日期再加上过期时间就行。如:

var oDate=new Date();

oDate.setDate(oDate.getDate()+7);  //设置过期时间

document.cookie='user=admin;password=123546;expires='+oDate;

原文地址:https://www.cnblogs.com/52css/p/3037382.html