/**
*設(shè)置cookie
*/
function setCookie(cookieName, cookieValue) {
????var date = newDate();
????var expiresDays = 1;
????date.setTime(date.getTime() + expiresDays * 24 * 3600 * 1000);// cookie失效時間
????document.cookie = cookieName +'='+ escape(cookieValue) +";expires="+ ????date.toGMTString()+";path=/";//+";path=/"
}
/**
*刪除cookie
*/
function DelCookie(name) {
????var exp = newDate();
????exp.setTime(exp.getTime() + (-1 * 24 * 60 * 60 * 1000));
????var cval = getCookieValueByName(name);
????document.cookie = name +"="+ cval +"; expires="+ exp.toGMTString()+";path=/";
}
/**
*讀取cookie值
*/
function getCookieValueByName(cookieName) {
????var cookieValue = null;
????var begin = document.cookie.indexOf(cookieName);
????if(begin != -1) {
????????begin += cookieName.length + 1;
????????var end = document.cookie.indexOf(";", begin);
????????if(end == -1) {
????????????end = document.cookie.length;
????????}
????????cookieValue = unescape(document.cookie.substring(begin, end));// 獲取cookieName的值
????}
????return cookieValue;
}