免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1768 | 回复: 1
打印 上一主题 下一主题

请问为什么DeleteCookie不起作用? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-09-10 15:15 |只看该作者 |倒序浏览
<html>;
<body onLoad="totdinit()">;
<script Language="JavaScript">;
bver=navigator.appVersion.split(";";
function totdstart(){
if(bver[1].match("5.")
rv=window.showModalDialog("dialog.bos",null,"dialogWidth:430px;dialogHeight:280px;center:1;scroll:0;help:0;status:0";
else
rv=window.showModalDialog("dialog.bos",null,"dialogWidth:430px;dialogHeight:300px;center:1;scroll:0;help:0";
nd= new Date();
nd.setTime (nd.getTime()+(365*24*60*60*1000));
cdomain = (location.domain) ? location.domain : null;
cpath = (location.domain) ? location.pathname : null;
if (rv!=0)
SetCookie ("totdc", "true", nd, cpath, cdomain);
}

function totdinit(){
if (document.all){
if (GetCookie("totdc"!="true"
totdstart()
else
document.body.insertAdjacentHTML('beforeEnd','<Div Id="etotd" style="width:140;position:absolute;top:0;left:0;BACKGROUND-COLOR:#B71717;BORDER-BOTTOM:#5C0000 solid 2px;BORDER-LEFT:#FE5E5E solid 2px;BORDER-RIGHT:#5C0000 solid 2px;BORDER-TOP:#FE5E5E solid 2px;font-family:宋体;font-size:9pt;font-weight:bold;text-align:center;padding-top:2px;padding-bottom:2px;color:#FFFFFF;cursor:default" onclick="enable()" onmouseover="mover()" onmouseout="mout()">;打开每日提示</Div>;');
}
}

function enable(){
DeleteCookie("totdc";
etotd.innerHTML="已经打开了";
setTimeout('etotd.style.visibility="hidden";totdstart()',1000);
}

function mover(){
etotd.style.borderLeftColor="#5C0000";
etotd.style.borderRightColor="#FE5E5E";
etotd.style.borderBottomColor="#FE5E5E";
etotd.style.borderTopColor="#5C0000";
etotd.style.paddingLeft="1px";
etotd.style.paddingTop="3px";
}

function mout(){
etotd.style.borderLeftColor="#FE5E5E";
etotd.style.borderRightColor="#5C0000";
etotd.style.borderBottomColor="#5C0000";
etotd.style.borderTopColor="#FE5E5E";
etotd.style.paddingLeft="0px";
etotd.style.paddingTop="2px";
}
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc >; 2) ? argv[2] : null;
  var path = (argc >; 3) ? argv[3] : null;
  var domain = (argc >; 4) ? argv[4] : null;
  var secure = (argc >; 4) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain));
}

function DeleteCookie(name){
exp=new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie ("name";
document.cookie = name + "=" + cval +"; expires=" + exp.toGMTString();
}
</script>;
</body>;
</html>;



为什么在点击“打开每日提示”后,DeleteCookie函数不起作用,删除不了cookie呀。

论坛徽章:
0
2 [报告]
发表于 2004-09-13 09:36 |只看该作者

请问为什么DeleteCookie不起作用?

为什么没人回答我的问题呀???

我顶!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP