//删除cookie
function delCookie(name){
var days = 7;
var value ="";
var path = "/";
var expires = new Date();
expires.setTime(expires.getTime() + days * 3600000 * 24);
//path = path == "" ? "" : ";path=" + path;
var _expires = (typeof days) == "string" ? "" : ";expires="
+ expires.toUTCString();
//var domain = ".banksteel.com";
//domain = domain == "" ? "" : ";domain=" + domain;
//document.cookie = name + "=" + value + _expires + path + domain;
document.cookie = name + "=" + value + _expires;
}
// 重写cookie内容(cookie名,cookie内容)
function reWriteCookie(name ,value) {
var days = 7;
var path = "/";
var expires = new Date();
expires.setTime(expires.getTime() + days * 3600000 * 24);
//path = path == "" ? "" : ";path=" + path;
//var domain = ".banksteel.com";
//domain = domain == "" ? "" : ";domain=" + domain;
var _expires = (typeof days) == "string" ? "" : ";expires="
+ expires.toUTCString();
//document.cookie = name + "=" + value + _expires + path + domain;
document.cookie = name + "=" + value + _expires;
}
/*
*根据cookie的name获取对应值
*/
function getCookie(name) {
var cookieValue = "";
var search = name + "=";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}