<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>这个一运行,就直接刷新id的值了.我这是用来记录文章ID.输出访问历史用的如何让他访问不同的页面时。追加shuid的值到 id中,而不是完全覆盖?document.cookie = document.cookie + "id="+ shuid + edp;我试过了,没用啊