兼容性IE8+
expires的值不能设置为小数,因为除了chrome,其他浏览器都不支持小数,所以我们必须使用setTime()来设置具体日期
jquery方法:
var date = new Date();
date.setTime(date.getTime()+10*1000);//只能这么写,10表示10秒钟
$.cookie('loginCount', ++loginCount, {expires: date});
js方法:
document.cookie='loginCount=1;expires='+new Date()+';path=/';