function getCookie(name)...{
var value = document.cookie;
var arr1 = value.split(";");
for(i=0;i<arr1.length;i++)...{
if(value.length == 0)...{
break;
}
sName = arr1[i].split("=")[0];
if(sName==name)...{
return arr1[i].split("=")[1];
}
}
return null;
}
/**//*****************************************
设置cookie的内容
*******************************************/
function SetCookie(sName,sValue)...{//建立cookie
//有点类似与匿名类哦
var expires = function()...{//cookie失效时间为从建立起48小时一内
var mydate = new Date();
mydate.setTime(mydate.getTime + 48*60*60*1000);
return mydate.toGMTString();
}
if(sName.length!=0 && sValue.length!=0)...{
document.cookie = sName + "=" + sValue + ";expires=" + expires;
}else...{
alert("您的填写有空!");
}
}
/**//*****************************************
删除cookie
*******************************************/
function DelCookie(sName,sValue)...{//删除一个指定的cookie键值对
document.cookie = sName + "=" + escape(sValue) + ";expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}
/**//*****************************************
删除cookie
*******************************************/
function DelCookie(sName)...{
var sValue=getCookie(sName);
if(sValue!=null)...{
document.cookie = sName + "=" + escape(sValue) + ";expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}
}
/**//*****************************************
清空cookie
*******************************************/
function clearCookie()...{
var value = document.cookie;
var arr1 = value.split(";");
for(i=arr1.length-1;i>=0;i--)...{
if(value.length == 0)...{
break;
}
sName = arr1[i].split("=")[0];
sValue = arr1[i].split("=")[1]
document.cookie = sName + "=" + escape(sValue) + ";expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}
}