复制代码 代码如下:
function setCookie(name,value,time){
var oDate = new Date();
oDate.setDate(oDate.getDate()+time);
document.cookie = name+"="+value+";expires="+oDate;
}
function getCookie(name){
var arr = document.cookie.split("; ");
for(var i=0; i<arr.length; i++){
var arr2 = arr[i].split("=");
if(arr2[0] == name){
return arr2[1];
}
}
return "";
}
function removeCookie(name){
setCookie(name,"",0)
}
function setCookie(name,value,time){
var oDate = new Date();
oDate.setDate(oDate.getDate()+time);
document.cookie = name+"="+value+";expires="+oDate;
}
function getCookie(name){
var arr = document.cookie.split("; ");
for(var i=0; i<arr.length; i++){
var arr2 = arr[i].split("=");
if(arr2[0] == name){
return arr2[1];
}
}
return "";
}
function removeCookie(name){
setCookie(name,"",0)
}
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“js中cookie的添加、取值、删除示例代码”评论...