/* 功能:保存cookies函数 参数:name,cookie名字;value,值 */ function setcookie(name,value){ var days = 0.1; //cookie 将被保存一周 var exp = new date(); //获得当前时间 exp.settime(exp.gettime() + days*600000); //换成毫秒 document.cookie = name + "="+ escape (value) + ";expires=" + exp.togmtstring(); } /* 功能:获取cookies函数 参数:name,cookie名字 */ function getcookie(name){ var arr = document.cookie.match(new regexp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null){ return unescape(arr[2]); }else{ return ""; } } /* 功能:删除cookies函数 参数:name,cookie名字 */ function delcookie(name){ var exp = new date(); //当前时间 exp.settime(exp.gettime() - 1); var cval=getcookie(name); if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.togmtstring(); } //根据json中的日期格式,转换成yyyy-mm-dd hh:mm:ss function changedateformat(cellval) { var date = new date(parseint(cellval.replace("/date(", "").replace(")/", ""), 10)); var month = date.getmonth() + 1 < 10 ? "0" + (date.getmonth() + 1) : date.getmonth() + 1; var currentdate = date.getdate() < 10 ? "0" + date.getdate() : date.getdate(); return date.getfullyear() + "-" + month + "-" + currentdate + " " + date.gethours() + ":" + date.getminutes() + ":" + date.getseconds(); }