JavaScript Cookie

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta charset="utf-8">
 5         <title></title>
 6         <script>
 7             function setCookie(name,value,iDay)
 8             {
 9                 var oDate=new Date();
10                 oDate.setDate(oDate.getDate()+iDay);
11 
12                 document.cookie=name+'='+value+';expires='+iDay;
13             }
14 
15             function getCookie(name)
16             {
17                 var arr=document.cookie.split('; ');
18                 for(var i=0;i<arr.length;i++)
19                 {
20                     var arr2=arr[i].split('=');
21                     if(arr2[0]==name)
22                     {
23                         return arr2[1];
24                     }
25                 }
26                 return '';
27             }
28 
29             function removeCookie(name){
30                 setCookie(name,1,-1);
31             }
32         </script>
33     </head>
34     <body>
35     </body>
36 </html>
Cookie
原文地址:https://www.cnblogs.com/shangec/p/12826879.html