我用抓包工具得到两个不同网站的数据包: 
第一个: 
HTTP/1.1 200 OK 
Cache-control: private; expires=0 
Pragma: no-cache 
LinkGateCode: OK 
Content-Type: text/html document.cookie="7i24LINKGATE=12403433566263x1173026144x12403433879953; domain=data1.mmsaini.com; path=/"; 
document.cookie="7i24LINKGATE=12403433566263x1173026144x12403433879953; domain=mmsaini.com; path=/"; 第二个: 
HTTP/1.1 200 OK 
Cache-control: private; expires=0 
Pragma: no-cache 
Content-Type: text/html 
Set-Cookie: 7i24LINKGATE=1251903217940x1173027775x1251949947438; domain=data.9063.com; path=/ 
Set-Cookie: 7i24LINKGATE=1251903217940x1173027775x1251949947438; domain=9063.com; path=/ 请问这两种写Cookie的方法有什么不同,谢谢了!!!

解决方案 »

  1.   

    对第二个网站使用如下方法可以对客户端设置Cookie,而第一个确不能设置,请问这该如何处理呢function ReadyStateChangeHandler()
     {
        if (xmlhttp.readyState==4)
           {
                xmlhttp.onreadystatechange=function()
                {};
                initdata();
           }
     }
                   try  
                     {  
                        var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                        xmlhttp.onreadystatechange=ReadyStateChangeHandler;
                        xmlhttp.open("POST", "http://rm1.9hai.com/hi.htm",true);
                        xmlhttp.setRequestHeader("Referer:","http://www.9hai.com/play/10512.htm");
                        xmlhttp.send("ok");
                     }
                     catch(e)  
                     {
                        alert("如果你看到这个提示,请给我们留言,这说明程序测试不通过,对您的支持与鼓励,我们表示由衷的感谢!")
             };