function createCookie(){
//a是cookie名,obj是cookie值
var cookievalue="1,5,8";
cCookie(cookievalue);
}
function cCookie(cookievalue){
document.cookie=cookiename+"="+cookievalue+";";
}
function getCookieVal(offset)
{
var endstr = document.cookie.indexOf(";", offset);
if(endstr == -1){
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
function getCookie(name)//读cookie
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while(i < clen){
var j = i + alen;
if (document.cookie.substring(i, j) == arg){
return getCookieVal(j);
}
i = document.cookie.indexOf(" ", i) + 1;
if(i == 0) break;
}
return;
}
function settextValue(){
var v=getCookie(cookiename);
var txt = document.getElementById("txt");
txt.value=v;
}
function delCookie(sName){// 删除 cookie
var date = new Date();
document.cookie = sName + "= ; expires=" + date.toGMTString();
}
js操作cookie
最新推荐文章于 2024-01-13 18:41:26 发布
1572

被折叠的 条评论
为什么被折叠?



