中国Java开发网 中国Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» 中国Java开发网 » AJAX讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 Javascript操作cookie完美实现
Happy漫步者





发贴: 28
于 2009-09-05 20:31 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
function setCookie(name, value, expires, path, domain, secure)
{document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function delCookie(name)
{var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = getCookie (name);
document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}
function getCookie(name){
var cookies = document.cookie.split( ';' );
var cookie = '';
for(var i=0; i<cookies.length; i++){
cookie = cookies[i].split('=');
if(cookie[0].replace(/^s+|s+$/g, '') == name) {
return (cookie.length <= 1) ? "" : unescape(cookie[1].replace(/^s+|s+$/g, ''));
}
}
return null;
}

function getExpDate(days, hours, minutes)
{var expDate = new Date();
if(typeof(days) == "number" && typeof(hours) == "number" && typeof(hours) == "number"){
expDate.setDate(expDate.getDate() + parseInt(days));
expDate.setHours(expDate.getHours() + parseInt(hours));
expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
return expDate.toGMTString();}
return null;}
-----
From:http://www.txdnet.cn/essay/view.jsp?tid=1252053157626&cid=2&f=_cjsdn_js_2



Happy漫步者花园 当我们失去的时候,才知道自己曾经拥有过

话题树型展开
人气 标题 作者 字数 发贴时间
7627 Javascript操作cookie完美实现 Happy漫步者 1252 2009-09-05 20:31

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2017 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号
客服电话 0592-8750026    客服信箱 714923@qq.com    客服QQ 714923