Var Cookies = {
// Read the Cookie. n is the Cookie name.
Get: function (n ){
Var re = new RegExp (n + '= ([^;] *);? ', 'Gi ');
Var r implements re.exe c (document. cookie) | [];
Return (r. length> 1? R [1]: null)
},
// Read the array Cookie. cookieName indicates the Cookie name and keyName indicates the key to be obtained.
GetArray: function (cookieName, keyName ){
Var oRegex1 = newRegExp (cookieName + '= ([^;] +)', 'I ');
Var values1 using oregex1.exe c (document. cookie );
If (values1 & values1.length> 1 ){
Var values2 = values1 [1]
Var oRegex2 = new RegExp (keyName + '= ([^ &] +)', 'I ');
Var oMatch using oregex2.exe c (values2 );
If (oMatch & oMatch. length> 1)
Return (oMatch [1]);
Else
Return '';
}
Else
Return '';
},
// Write Cookies (arrays not writable). n indicates the Cookie name, v indicates the Cookie value, h indicates the time (in hours), p indicates the Cookie Path, and d indicates the Domain, s is secure
Set: function (n, v, h, p, d, s ){
Var t = new Date ();
If (h ){
// 8.64e7 one day 3.6e6 one hour
T. setTime (t. getTime () + (h * 3.6e6 ));
}
Document. cookie = n + '=' + escape (v) + ';' + (! H? '': '; Expires =' + t. toGMTString () + (! P? '': '; Path =' + p) + (! D? '': '; Domain =' + d) + (! S? '': '; Secure') // Set cookie
},
// Delete the Cookie. n indicates the Cookie name, p indicates the Cookie Path, and d indicates the Domain name.
Del: function (n, p, d ){
Var t = newDate (); // obtain the current time
T. setTime (t. getTime ()-10000); // set date to the past time.
Document. cookie = n + '=' + (! P? '': '; Path =' + p) + (! D? '': '; Domain =' + d) + '; expires =' + t. toGMTString ();
}
};
From the wjw.verson Column