var times = 's60';
var key ='token';
var value = '123';
var strsec = get_sec(times);
var exp = new Date();
exp.setTime(exp.getTime() + strsec * 1);
document.cookie = key + "=" + escape(value) + ";expires=" + exp.toGMTString() + ';path=/';
function get_sec(str) {
var str1 = str.substring(1, str.length) * 1;
var str2 = str.substring(0, 1);
if (str2 == "s") {
return str1 * 1000;
} else if (str2 == "h") {
return str1 * 60 * 60 * 1000;
} else if (str2 == "d") {
return str1 * 24 * 60 * 60 * 1000;
}
}
console