jquery.zf_tc_cookie = function (name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options = $.extend({}, options); options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toutcstring)) { var date; if (typeof options.expires == 'number') { date = new date(); date.settime(date.gettime() + (options.expires * 60 * 1000)); //这里改时间,单位毫秒,默认为1分钟。 } else { date = options.expires; } expires = '; expires=' + date.toutcstring(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeuricomponent(value), expires, path, domain, secure].join(''); } else { var cookievalue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jquery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookievalue = decodeuricomponent(cookie.substring(name.length + 1)); break; } } } return cookievalue; } };