php判断首次打开,JS通过Cookie判断页面是否为首次打开_javascript技巧

废话不多说了,直接给大家贴代码了,本文写的不好还请各位大侠见谅。

JScript code:

function Cookie(key,value)

{

this.key=key;

if(value!=null)

{

this.value=escape(value);

}

this.expiresTime=null;

this.domain=null;

this.path="/";

this.secure=null;

}

Cookie.prototype.setValue=function(value){this.value=escape(value);}

Cookie.prototype.getValue=function(){return (this.value);}

Cookie.prototype.setExpiresTime=function(time){this.expiresTime=time;}

Cookie.prototype.getExpiresTime=function(){return this.expiresTime;}

Cookie.prototype.setDomain=function(domain){this.domain=domain;}

Cookie.prototype.getDomain=function(){return this.domain;}

Cookie.prototype.setPath=function(path){this.path=path;}

Cookie.prototype.getPath=function(){return this.path;}

Cookie.prototype.Write=function(v)

{

if(v!=null)

{

this.setValue(v);

}

var ck=this.key+"="+this.value;

if(this.expiresTime!=null)

{

try

{

ck+=";expires="+this.expiresTime.toUTCString();;

}

catch(err)

{

alert("expiresTime参数错误");

}

}

if(this.domain!=null)

{

ck+=";domain="+this.domain;

}

if(this.path!=null)

{

ck+=";path="+this.path;

}

if(this.secure!=null)

{

ck+=";secure";

}

document.cookie=ck;

}

Cookie.prototype.Read=function()

{

try

{

var cks=document.cookie.split("; ");

var i=0;

for(i=0;i

HTML code:

以上所述是小编给大家分享JS通过Cookie判断页面是否为首次打开的相关内容,希望对大家有所帮助。

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值