一:存Cookie
//存Cookie
document.cookie = "id=" + escape(value);
二:取Cookie
//提取Cookie值
function getCookie(name) {
//取出cookie
var strCookie = document.cookie;
//cookie的保存格式是 分号加空格 "; "
var arrCookie = strCookie.split("; ");
for (var i = 0; i < arrCookie.length; i++) {
var arr = arrCookie[i].split("=");
if (arr[0] == name) {
return unescape(arr[1]);
}
}
return "";
}