- 存取cookie
//debugger; //每次发消息打开聊天窗口时候把chatid和chatcode存入到cookie中 var pd; if (document.cookie.length>0){ pd=document.cookie.indexOf(chatId+"="); if(pd==-1){ document.cookie=chatId+"="+chatId+"+"+chatCode+"+"+nickName; } }
document.cookie=chatId+"="+chatId+"+"+chatCode+"+"+nickName;
document.cookie=chatId+"="+'what'+"+"+'wx'+"+"+'uuuu';
document.cookie='chat'+"="+'what'+"+"+'wx'+"+"+'uuuu';
"chat=what+wx+uuuu"
document.cookie='chat'+"="+'what'+"+"+'wx'+"+"+'uuuu';
var str=document.cookie.split(";")[0].split("+")[1];
"chat=what+wx+uuuu"
document.cookie='chat'+"="+'what'+"+"+'wx'+"+"+'uuuu';
var str=document.cookie.split(";")[0].split("+")[1];
Console.log(str);
document.cookie='chat'+"="+'what'+"+"+'wx'+"+"+'uuuu';
var str=document.cookie.split("=")[0];
console.log(str)
document.cookie='chat'+"="+'what'+"+"+'wx'+"+"+'uuuu';
var str=document.cookie.split("=")[1];
console.log(str)
VM426:3 0; bdUid
document.cookie='chat'+"="+'what'+"+"+'wx'+"+"+'uuuu';
"chat=what+wx+uuuu"
console.log(document.cookie)
VM442:1 sts=0; bdUid=6BB15BD91327000C720E79AA0008; wc=57494; lc=57494; lc2=57494; wc_n=%25u6B66%25u6C49; BAIDU_SSP_lcr=http://www.xrccp.com/23.html; Hm_lvt_6ab7a391c8d69b4f62b7c54b2d70919c=1551718998,1551719005; Hm_lpvt_6ab7a391c8d69b4f62b7c54b2d70919c=1551719005; chat=what+wx+uuuu
//分割字符串按照 “;”进行分割在加号的第0个位置
console.log(document.cookie.split(";")[9].split("=")[1].split("+")[0])
what
//分割字符串按照 “=”进行分割在等号的第0个位置
console.log(document.cookie.split(";")[9].split("=")[0])
chat