The examples in this article describe the methods used by the JavaScript cookie base to record user names. Share to everyone for your reference, specific as follows:
 
There is a previous article on the basis of cookies, encapsulating the cookie.js, we use an example to apply this JS.
 
The most common is to remember the user name, when the user logged in once, through a cookie to record the user's account number and password, so the next time you open the page do not need to enter the account password again. Attached code:
 
 
PS: Here again the previous section of the Cookie.js posted out to facilitate everyone to view:
 
 
  
  
function Setcookie (name,value,hours) {
 var d = new Date ();
 D.settime (D.gettime () + hours * 3600 * 1000);
 Document.cookie = name + ' = ' + value + '; Expires= ' + d.togmtstring ();
}
function GetCookie (name) {
 var arr = Document.cookie.split ('; ');
 for (var i = 0; i < arr.length i++) {
  var temp = arr[i].split (' = ');
  if (temp[0] = = name) {return
   temp[1];
  }
 }
 return ';
}
function Removecookie (name) {
 var d = new Date ();
 D.settime (D.gettime ()-10000);
 Document.cookie = name + ' = 1; Expires= ' + d.togmtstring ();
}
 
   
  
More readers interested in JavaScript-related content can view this site: "JavaScript in the JSON Operation tips Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"
 
I hope this article will help you with JavaScript programming.