Javascript 原生Cookie使用用法
var oCookie = { setCookie: function (name, value, expireDays, path, domain) { var expireDays = expireDays || 0, //天数 path = path || '/', //路径 domain = domain || '', //域名 date = new Date(); date.setDate(date.getDate() + expireDays); document.cookie = escape(name) + '=' + escape(value) + ';expire=' + date.toGMTString() + ';path=' + path + ';domain=' + domain; }, getCookie: function (name) { var str = document.cookie, arr = str.split('; '), _temp = ''; for (var i in arr) { _temp = arr[i].split('='); if (_temp[0] == escape(name)) return unescape(_temp[1]); } }, delCookie: function (name) { document.cookie = escape(name) + '=' + null + ';expires=' + (new Date(0)).toGMTString(); } }