var _topdomain=document.domain.replace(/www./,'');function MySetCookie( sName, sValue , expDay )
{
date = new Date();
var currT = date.getTime();
var nD = new Date(currT+(expDay*86400000));
if(arguments[3]){sValue=escape(sValue);}
vcook =sName+"="+sValue+";expires="+nD.toGMTString()+";domain="+_topdomain+";path=/";
document.cookie = vcook;
}用这个得到的cookie只显示“Sname=;”为什么值为空呢。
{
date = new Date();
var currT = date.getTime();
var nD = new Date(currT+(expDay*86400000));
if(arguments[3]){sValue=escape(sValue);}
vcook =sName+"="+sValue+";expires="+nD.toGMTString()+";domain="+_topdomain+";path=/";
document.cookie = vcook;
}用这个得到的cookie只显示“Sname=;”为什么值为空呢。
解决方案 »
- JS 类的继承中属性值的问题
- jquery ui 中的accordion布局中如何嵌套树状菜单
- 文本框获取焦点事件!
- 如何让网页打开时候最小化,6秒后最大化
- 在线等待,谢谢了,简单问题
- 有没办法禁止网页重定向?
- 求助:如何改变<input type="text">为<input type="password">
- 高分求一个用js实现的树型下拉列表框
- 紧急:document.frmTest.selTest.options[1].selected=true;为什么不好使?
- 如何消除链接文本的下划线
- 如何让网页打开时占满整个window对象区域?
- 问下这样的窗口一般有几种方法,感觉非常漂亮也比较广泛
谢谢,alert(vcook)后是有相应值的。
但是alert(document.cookie)只有设置的cookie名称=;急死了。
试一试看看有东西么?
document.cookie = escape(vcook);
alert(unescape(document.cookie));