This article mainly introduces JS encapsulated cookie operation functions, and analyzes the related techniques for setting, obtaining, and deleting cookies in JavaScript in the form of examples. It has some reference value, for more information, see the examples in this article. We will share this with you for your reference. The details are as follows:
/* Set cookie */function setCookie (name, value, iDay) {var oDate = new Date (); oDate. setDate (oDate. getDate () + iDay); document. cookie = name + '=' + value + '; expires =' + oDate ;};/* usage: setCookie ('user', 'simon ', 11 ); * // * get cookie */function getCookie (name) {var arr = document. cookie. split (';'); // multiple cookie values are separated by;. split the cookie and assign the value to the array for (var I = 0; II hope this article will help you design JavaScript programs.