复制代码 代码如下: <BR>if(getCookie("num")){ <BR>var nn=parseInt(getCookie("num")); <BR>setCookie("num",++nn); <BR>}else{ <BR>setCookie("num",1); <BR>} <BR>function getCookie(name){ <BR>var str=document.cookie.split(";"); <BR>for(i=0;i<str.length;i++){ <BR>var str2=str[i].split("=") <BR>if(str2[0].replace(/\s(.*)\s/,"$1")==name){ <BR>return str2[1]; <BR>} <BR>} <BR>} <BR>function setCookie(name,value){ <BR>var Days=30; <BR>var exp = new Date(); <BR>exp.setTime(exp.getTime() + Days*24*60*60*1000); <BR>document.cookie = name + "="+ escape(value) +";expires"+ exp.toGMTString(); <BR>} <BR>alert("您是第"+getCookie("num")+"次访问"); <br><br>/*String.prototype.Trim=function(){ <BR>return this.replace(/\s(.*)\s/,"$1"); <BR>} <BR>String.prototype.alert2=function(str){ <BR>alert("我是alert2!!!哈哈哈哈 实际内容是:"+str); <BR>} <BR>var aa=""; <BR>aa.alert("liugang");*/ <BR>