- var Cookie = {
- get: function (name) {
- var name = name + "=";
- var ca = document.cookie.split(';');
- for (var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') c = c.substring(1);
- if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
- }
- return "";
- },
- remove: function (name, path, domain) {
- if (this.get(name)) {
- document.cookie = name + "="
- + ((path) ? "; path=" + path : "")
- + ((domain) ? "; domain=" + domain : "")
- + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
- }
- }
- };
- //该片段来自于http://www.codesnippet.cn/detail/2011201514067.html
来源: http://www.codesnippet.cn/detail/2011201514067.html