答案:5.显示来了几次 当访客每次来的时候,都可以知道自己究竟来的几次,他会觉得站长一直把他当作贵宾对待而心存感激,而你要做的只是加一段代码罢了^_^
具体方法:
在网页HTML源文件的<body>和</body>之间的空白处点击鼠标,输入:
<script language=”Javascript”>
<!--
function getCookieVal(offset)
{var endstr=documents.cookie.indexOf(";",offset);
if(endstr==-1)
endstr=documents.cookie.length;
return unescape(documents.cookie.substring(offset,endstr));}
function GetCookie(name)
{var arg=name+"=";var alen=arg.length;
var clen=documents.cookie.length;var i=0;
while(i<clen)
{var j=i+alen;
if(documents.cookie.substring(i,j)==arg)
return getCookieVal(j);
i=documents.cookie.indexOf(" ",i)+1;
if(i==0)
break;}
return null;}
function SetCookie(name,value)
{var argv=SetCookie.arguments;
var argc=SetCookie.arguments.length;
var expires=(2<argc)?argv[2]:null;
var path=(3<argc)?argv[3]:null;
var domain=(4<argc)?argv[4]:null;
var secure=(5<argc)?argv[5]:false;
documents.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");}
var expdate=new Date();
var visits;
expdate.setTime(expdate.getTime()+(24*60*60*1000*365));
if(!(visits=GetCookie("visits")))
visits=0;
visits++;
SetCookie("visits",visits,expdate,"/",null,false);
if(document.lastModified.substring(2,3)=="/")
document.write(“你已经来了”);
document.write("<font color=red ><B>"+visits+"</font>"+"</B> ");
document.write(“次了!”);
-->
</script>
保存退出。我设置的数字字体颜色是大红,汉字颜色是默认的。