如何制作访客最后来访记录要添加此好工具到您的博客只需遵循这几个简单的步骤就可以了。

1.进入您的控制台--> 布局- -> 页面元素。

2.在侧边栏单击 "添加小工具"。

3.选择" HTML/JavaScript "然后把以下的脚本贴上和单击储存.


<script type = "text/javascript">

var days = 730; // days until cookie expires = 2 years.
var lastvisit=new Object();
var firstvisitmsg="(。◕‿◕。)这是您第一次到访本站. 欢迎光临!(。◕‿◕。)";
lastvisit.subsequentvisitmsg="(。◕‿◕。)欢迎回来! 您最后来访日期是在 <br /><b>[displaydate]</b>";

lastvisit.getCookie=function(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1];
return'';
}

lastvisit.setCookie=function(name, value, days){
var expireDate = new Date();

var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}

lastvisit.showmessage = function() {
var wh = new Date();
if (lastvisit.getCookie("visitc") == "") {
lastvisit.setCookie("visitc", wh, days);
document.write(firstvisitmsg);
}

else {
var lv = lastvisit.getCookie("visitc");
var lvp = Date.parse(lv);
var now = new Date();
now.setTime(lvp);
var day = new Array("星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
var month = new Array ("正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月");
var dd = now.getDate();
var dy = now.getDay();
dy = day[dy];
var mn = now.getMonth();
mn = month[mn];
yy = now.getFullYear();
var hh = now.getHours();
var ampm = "上午";
if (hh >= 12) {ampm = "下午"}
if (hh >12){hh = hh - 12};
if (hh == 0) {hh = 12}
if (hh < 10) {hh = "0" + hh};
var mins = now.getMinutes();
if (mins < 10) {mins = "0"+ mins}
var secs = now.getSeconds();
if (secs < 10) {secs = "0" + secs}
var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " + hh + ":" + mins + ":" + secs + " " + ampm
document.write(lastvisit.subsequentvisitmsg.replace("\[displaydate\]", dispDate))
}

lastvisit.setCookie("visitc", wh, days);

}

lastvisit.showmessage();

</script>



4.现在把它储存然后刷新页面就大功告成,是不是很简单赶快试咯!!!

0 comments

Post a Comment

(。◕‿◕。)感谢你的热情回应(。◕‿◕。)

Recent Comments

关于91部落格

我是:李凡
年龄:明年+1岁
性别:男的假不了
兴趣:扮猫
专长:写一些人看不懂的Blog
地址:http://91blogger.blogspot.com
Blog目的:写Blog咯!
目前状况
目前91部落格还在未成年阶段,希望各位大大们多多支持。
关于部落石破(blogspot)技巧和贴士的分享李凡都是在劳改时从这里这里还有这里磨练成的。幸运的是老天赐李凡于慧根除了看懂各国语言之际,还赐予无限的创意。所以才能在这里和大家‘烟酒烟酒’。
俗语有言:“长江后浪推前浪,前浪死在沙滩上”
这些分享的技巧都是经过李凡测试和挑选的,因李凡觉得有很多技巧根本不适合的。有些的技巧不是没效果就是会有Bug。所以李凡推荐比较实际一些的技巧,最重要部落格还是不要太复杂,影响到页面速度就“偷鸡不到食鸡粮”了。
还有什么交代
凡走过必有足迹,凡写下必有笔迹,
凡路过必有惊喜,凡看过必有回应。

最近发布

有朋自远方来,不Follow亦乐乎?

如果真的真的很不错,就推广吧!