<script>
var Url = location.href;//取地址
var shuid=Url.substr(0,Url.lastIndexOf("/"));
shuid=shuid.substr(shuid.lastIndexOf("/")+1)
var expTime = new Date(new Date().setDate(new Date().getDate() + 500));//设定过期时间为500天
var edp = ";expires=" + expTime.toGMTString() + "; path=/"; //; domain=www.xxxx.net //组合Cookie参数
var allCookie = document.cookie; //取出全部Cookie
if(allCookie.indexOf("id=") != -1
document.cookie = "id="+ shuid + edp;
</script>这段代码写入的cookies只显示最新的..直接吧id值覆盖掉了..但是我想叠加写入应该怎么改?
var Url = location.href;//取地址
var shuid=Url.substr(0,Url.lastIndexOf("/"));
shuid=shuid.substr(shuid.lastIndexOf("/")+1)
var expTime = new Date(new Date().setDate(new Date().getDate() + 500));//设定过期时间为500天
var edp = ";expires=" + expTime.toGMTString() + "; path=/"; //; domain=www.xxxx.net //组合Cookie参数
var allCookie = document.cookie; //取出全部Cookie
if(allCookie.indexOf("id=") != -1
document.cookie = "id="+ shuid + edp;
</script>这段代码写入的cookies只显示最新的..直接吧id值覆盖掉了..但是我想叠加写入应该怎么改?
var shuid=Url.substr(0,Url.lastIndexOf("/"));
shuid=shuid.substr(shuid.lastIndexOf("/")+1)
var expTime = new Date(new Date().setDate(new Date().getDate() + 500));//设定过期时间为500天
var edp = ";expires=" + expTime.toGMTString() + "; path=/"; //; domain=www.xxxx.net //组合Cookie参数
var allCookie = document.cookie; //取出全部Cookie
if(allCookie.indexOf("id=") != -1
document.cookie = "id="+ shuid + edp;
cument.cookie = document.cookie + ";id="+ shuid + edp;
</script>cookies里id值重复了一遍