这些代码来自Javascriptkit,只要新建一个Html/javascript模块,把下面的代码放进去即可。当然,你可以更改欢迎信息。
<script type="text/javascript">
var lastvisit=new Object()
lastvisit.firstvisitmsg="这是你第一次光临本站" //Change first visit message here
lastvisit.subsequentvisitmsg="欢迎回来,你上一次到来是在 <b>[displaydate]</b>" //Change subsequent visit message herelastvisit.getCookie=function(Name){ //get cookie value
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}lastvisit.setCookie=function(name, value, days){ //set cookei value
var expireDate = new Date()
//set "expstring" to either future or past date, to set or delete cookie, respectively
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days))
document.cookie = name+"="+value+" expires="+expireDate.toGMTString()+" path=/"
}lastvisit.showmessage=function(){
if (lastvisit.getCookie("visitcounter")==""){ //if first visit
lastvisit.setCookie("visitcounter", 2, 730) //set "visitcounter" to 2 and for 730 days (2 years)
document.write(lastvisit.firstvisitmsg)
}
else
document.write(lastvisit.subsequentvisitmsg.replace("\[displaydate\]", new Date().toLocaleString()))
}lastvisit.showmessage()
</script>
2 条评论:
多谢鱼的提醒啊,那个flash如果调太小的话就看不见了,目前偶还没想到好的方法解决.
今天这个功能比较不错,试用下先
我们的看法正好相反,我觉得这些小玩意儿没多大用处。
发表评论