Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)delv
published in(发表于) 2013/12/29 4:44:48
如何让javascript,操作Cookie_php资料_编程技术

如何让javascript 操作Cookie_php资料_编程技术-你的首页-uuhomepage.com
其实很简单


document.cookie="proZiLiao=1;";

内容是以key=value的形式,用;分号分隔


读取的话


var cks = document.cookie.split(";");
按照;分号分隔为数组
for(i=0;i<cks.length;i++)
{
var val = cks[i].substring(0,cks[i].indexOf("=")); //字符串方式截取=号两边的

if(val.replace(" ","")=="proZiLiao"){
alert(
"this Cookie!"
);
}

}




If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759