1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| function Cookie(){
this.__constructH=function(name,value,path,host){
oDate=new Date(2014,11,21,17,12,02);
document.cookie=name+"="+escape(value)+"; expires="+oDate.toGMTString()+";path="+path+";host="+host+"";
}
this.__constructD=function(name,value,path,domain){
oDate=new Date(2014,12,25,23,30,45);
document.cookie=name+"="+escape(value)+"; expires="+oDate.toGMTString()+";path="+path+";domain="+domain+"";
}
this.getCookie=function(name){
if(document.cookie.indexOf(";",0)!=-1){
var sValue="";
var valueOfCookie=document.cookie.split(";");
searchName:
for(var i=0;i<valueOfCookie.length;i++){
if(valueOfCookie[i].indexOf(name+"=",0)!=-1){
sValue=valueOfCookie[i].substring(valueOfCookie[i].indexOf(name+"=",0),valueOfCookie[i].length);
aValue=sValue.split("=");
break searchName;
}
}
return aValue[1];
}
else{
if(document.cookie.indexOf(name+"=",0)!=-1){
sValue=document.cookie.substring(document.cookie.indexOf(name+"=",0),document.cookie.length);
aValue=sValue.split("=");
return aValue[1];
}
}
}
this.getCookies=function(){
return document.cookie;
}
this.CookieExist=function(name){
if(document.cookie.indexOf(";",0)!=-1){
var valueOfCookie=document.cookie.split(";");
for(var i=0;i<valueOfCookie.length;i++){
if(valueOfCookie[i].indexOf(name+"=",0)!=-1){
return true;
}
}
}
else{
if(document.cookie.indexOf(name+"=",0)!=-1){
return true;
}
}
}
this.deleteCookieD=function(name,domain){
oDate=new Date(2000,12,25,23,30,45);
document.cookie=name+"=xxxxx; expires="+oDate.toGMTString()+";path=/;domain="+domain+"";
}
this.deleteCookieH=function(name,host){
oDate=new Date(2000,12,25,23,30,45);
document.cookie=name+"=xxxxx; expires="+oDate.toGMTString()+";path=/;host="+host+"";
}
} |
Partager