标签:cookie cti user 函数 highlight func get 存储 rem
百度了一下,借用了别人的setCookie,getCookie函数,采用cookie来存储一下即可,(Js脚本)
function setCookie(name, value, iDay) { var oDate=new Date(); oDate.setDate(oDate.getDate()+iDay); document.cookie=name+‘=‘+encodeURIComponent(value)+‘;expires=‘+oDate; } function getCookie(name) { var arr=document.cookie.split(‘; ‘); var i=0; for(i=0;i<arr.length;i++) { //arr2->[‘username‘, ‘abc‘] var arr2=arr[i].split(‘=‘); if(arr2[0]==name) { var getC = decodeURIComponent(arr2[1]); return getC; } } return ‘‘; } function removeCookie(name) { setCookie(name, ‘1‘, -1); }
标签:cookie cti user 函数 highlight func get 存储 rem
原文地址:http://www.cnblogs.com/winv758241/p/6876029.html