Cookie保存和获取
//getCookie 得到指定名称的cookie的值var bikky = document.cookie;function getCookie(name) { var index = bikky.indexOf(name + "="); if (index == -1) return null; index = bikky.indexOf("=", index) + 1; var endstr = bikky.indexOf(";", index); if (endstr == -1) endstr = bikky.length; return unescape(bikky.substring(index, endstr));}//设置保存cookie的时间为3秒的方法//setCookie//var Days = 60; //cookie 将被保存两个月 //var exp = new Date(); //获得当前时间 //exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); //换成毫秒 function setCookie(name, value) { var exp = new Date(); //获得当前时间 exp.setTime(exp.getTime() + 3*1000); //换成 1000代表毫秒 3*1000是3秒 if (value != null && value != "") document.cookie=name + "=" + escape(value) + "; expires=" + exp.toGMTString();}