admin 发表于 2011-7-20 12:14:08

javscript读取/设置cookie函数

//取cookie函数
function getcookie(name){
  var str=document.cookie.match(eval('/(^| )'+name+'\=(.*)(;|$)/i'));
  return unescape(RegExp.$2);
}
//置cookie函数
function setcookie(name,value,min,path,domain){
if(typeof(min)=="undefined"||typeof(min)==null) min=5;
var pathstr="";
var domainstr="";
if(typeof(path)!="undefined") pathstr=";path="+path;
if(typeof(domain)!="undefined") pathstr=";domain="+domain;
  var time=new Date();
time.setTime(time.getTime()+(min*60*1000));
  document.cookie=name+"="+escape(value)+";expires="+time.toGMTString()+pathstr+domainstr;
}

郭川力 发表于 2011-9-17 16:48:54

希望大家发表自己的看法!我先赞成一下











static/image/common/sigline.gif
淘宝网特卖:http://t.cn/arytfd     淘宝电器城:http://t.cn/ar8hfv

侃呀侃之灵 发表于 2011-9-23 22:44:49

经验之谈,谢谢楼主了,请继续努力











static/image/common/sigline.gif
1.85狂雷版本 1.85星王传奇 1.95皓月无内功 1.80战神复古 1.76复古传奇 1.95皓月无内功 www.siedu.cn www.a148.com  http://516x.com
页: [1]
查看完整版本: javscript读取/设置cookie函数