手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >JS通过Cookie判断页面是否为首次打开
JS通过Cookie判断页面是否为首次打开
摘要:废话不多说了,直接给大家贴代码了,本文写的不好还请各位大侠见谅。JScriptcode:functionCookie(key,value){...

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

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

【JS通过Cookie判断页面是否为首次打开】相关文章:

JS中的Replace方法使用经验分享

使用JavaScript刷新网页的方法

用于table内容排序

JavaScript对W3C DOM模版的支持情况详解

jQuery判断指定id的对象是否存在的方法

百度地图给map添加右键菜单(判断是否为marker)

关于JavaScript作用域你想知道的一切

Javascript通过overflow控制列表闭合与展开的方法

javascript先序遍历DOM树的方法

新页面打开实际尺寸的图片

精品推荐
分类导航