Posted in Javascript onNovember 24, 2009
<script type="text/javascript"> if(getCookie("num")){ var nn=parseInt(getCookie("num")); setCookie("num",++nn); }else{ setCookie("num",1); } function getCookie(name){ var str=document.cookie.split(";"); for(i=0;i<str.length;i++){ var str2=str[i].split("=") if(str2[0].replace(/\s(.*)\s/,"$1")==name){ return str2[1]; } } } function setCookie(name,value){ var Days=30; var exp = new Date(); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape(value) +";expires"+ exp.toGMTString(); } alert("您是第"+getCookie("num")+"次访问"); /*String.prototype.Trim=function(){ return this.replace(/\s(.*)\s/,"$1"); } String.prototype.alert2=function(str){ alert("我是alert2!!!哈哈哈哈 实际内容是:"+str); } var aa=""; aa.alert("liugang");*/ </script>
js cookies实现简单统计访问次数
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@