<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统计访问次数
最新推荐文章于 2021-04-01 06:14:54 发布