87,910
社区成员
发帖
与我相关
我的任务
分享
function setCookies(cname, cvalue, expiredays) {
var exdate = new Date();
exdate.setTime(exdate.getTime() + expiredays * 3600 * 1000);
var cookieValue = cname + "=" + escape(cvalue) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()+";path=/");
document.cookie = cookieValue;
}
function getCookie(cname) {
if (document.cookie.length > 0) {
var cstart = document.cookie.indexOf(cname + "=");
if (cstart >= 0) {
cstart = cstart + cname.length + 1;
cend = document.cookie.indexOf(";", cstart);
if (cend == -1) {
cend = document.cookie.length;
}
return unescape(document.cookie.substring(cstart, cend));
}
}
return "";
}
function delCookie(cname) {
alert(getCookie(cname))
if (getCookie(cname).length > 0) {
document.cookie = cname + "=" + ";expire=" + (new Date()).toGMTString();
}
}