function setCookie(name, value, expires, path, domain, secure) {
        var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "/") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")
        if (!caution || (name + "=" + escape(value)).length <= 4000)
                document.cookie = curCookie
        else
                if (confirm("Cookie exceeds 4KB and will be cut!"))
                        document.cookie = curCookie
}
有时候coolies值为null 什么原因呢?

解决方案 »

  1.   

    有大量的数据 但是其中有少部分COOKIE值是null 是浏览器兼容性问题吗?
      

  2.   

    检查下设进去的时候有没值?因为不是每个都是NULL的话.应该不是这里的问题.
      

  3.   

    function randomNumber(limit){
    return Math.floor(Math.random()*limit+1);
    }n = randomNumber("1987119882042190873");我用的是这个函数来确定N的值 难道这样的随机有为空的情况?
      

  4.   

    会不会是cookie满了 这个怎么来解决呢??
      

  5.   

    大量的数据就不要放到COOKIE里了嘛~~ 感觉可能是满了 可以测试测试少放些数据会不会有这现象