/***** function: Cookie Operation object ***/var cookies = {/*** * * Function: Write cookie Operation * * parameter: Name Cookie * * * value Cooki E-Value * * Expires Expiration Time * * Path paths * * Domain ***/set:function (name, value, expire s, path, domain) {expires = new date (). GetTime () + (((typeof expires = = "undefined")? * 7200:expire s)) * 1000); var Tempcookie = name + "=" + Escape (value) + ((expires)? "; Expires= "+ expires.togmtstring ():" ") + (path)?; Path= "+ Path:"; path=/") + (domain)? "; domain= "+ domain:" "); (Tempcookie.length < 4096)? Document.cookie = Tempcookie:alert ("The cookie is bigger than Cookie lagrest"); },/*** * * Function: Get cookie Operation * * parameter: Name Cookie name ***/get:function (name) {var Xarr = Document.coo Kie.match (New RegExp ("(^|)" + name + "= ([^;] *)(;|$)")); if (Xarr! = null) return unescape (xarr[2]); return null; },/*** * * GongCan: Delete Cookie action * * Parameter: Name Cookie * * * Path PATH * * Domain ***/del:function (name, path , domain) {if (This.get (name)) Document.cookie = name + "=" + (path)? "; Path= "+ Path:"; path=/") + (domain)? "; domain= "+ domain:" ") +"; Expires=thu, 01-jan-1970 00:00:01 GMT "; }, Day:function (XD) {return xd * 24 * 3600; }, Hour:function (XH) {return XH * 3600; }}
JS Cookie Read and write operation