分类: 系统运维
2006-08-17 16:31:25
function getCookie (name) {
var CookieFound = false;
var start = 0;
var end = 0;
var CookieString = document.cookie;
var i = 0;
while (i <= CookieString.length) {
start = i ;
end = start + name.length;
if (CookieString.substring(start, end) == name){
CookieFound = true;
break;
}
i++;
}
if (CookieFound){
start = end + 1;
end = CookieString.indexOf(";",start);
if (end < start)
end = CookieString.length;
return unescape(CookieString.substring(start, end));
}
return "";
}
function deleteCookie(name){
var expires = new Date();
expires.setTime (expires.getTime() - 1);
setCookie( name , "Delete Cookie", expires,null,null,false);
}