AspScript和AspVBscript其實(shí)是同一個(gè)東西,asp腳本一般用VBScript編寫(xiě),也有的用java script編寫(xiě)(功能是一樣的),不過(guò)用vbs的比較多。
你要加計數器的話(huà),要看你購買(mǎi)的空間支持哪些腳本
一般win2000主機支持ASP(即VBScript),cgi等,linux主機支持php,jsp,cgi。
如果你確定使用支持asp的空間,就要找asp編寫(xiě)的計數器。
站點(diǎn)的訪(fǎng)問(wèn)計數器一般比較簡(jiǎn)單。
下面是一個(gè)簡(jiǎn)單的基于文本的圖形計數器,統計次數放在一個(gè)文本文件count.txt里
這個(gè)計數器包括如下文件:
counter.asp ---執行計數功能
count.txt---存放數字
c0.gif,c1.gif.....c9.gif ---0-9的圖形,你要是想換成漂亮的計數器,只要替換這些圖形就可以
下面是計數器counter.asp的源代碼(需要你的空間支持FSO功能)
<html>
<head>
<title>counter</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#000000" text="#000000">
<%
dim visitors,fs
whichfile=server.mappath("count.txt")
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile)
visitors=thisfile.readline
thisfile.close
countlen=len(visitors)
countsize=7
if countlen<countsize and i<countlen then
for j=1 to (countsize-countlen)
res0402ponse.write "<img src=""c0.gif""></img>"
next
for i=1 to countlen
res0402ponse.write "<img src=""c" & mid(visitors,i,1) & ".gif""></img>"
next
end if
visitors=visitors+1
Set out=fs.CreateTextFile(whichfile)
out.WriteLine(visitors)
out.close
set fs=nothing
%>
</body>
</html>
你可以把上面這些文件都放到一個(gè)count目錄里面,便于管理
顯示的時(shí)候在網(wǎng)頁(yè)需要顯示計數器的位置插入如下源代碼
<iframe bgcolor="#000000" src="count/counter.asp" width="63" height="15" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>
一個(gè)簡(jiǎn)單的計數器就可以使用了。
希望對大家有點(diǎn)用...