我有个站,想加个简单的记数功能,找了一段代码,我想把他变成LIB。ASP文件中的一个函数,然后把一个数字返回到调用它的主程序中,成为一个字符串的一部分,请问该怎么调用呀。函数格式怎么写呢。具体地址是www.sxgtzyschool.cn,下面的你是第000000位访问者就是这个问题的出处,我想用一个变量通过调用函数,返回值自动加一,可是这行中的所有字符串都在LIB。ASP文件中,怎么写都写不对。请教高手帮帮小菜鸟,谢谢。代码如下:(LIB.ASP)
'==================================
'=过 程 名:countt
'=功 能:访问量统计
'==================================
function countt(str)
str="000000"
Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
Path = "Data Source=" & Server.MapPath("visite#data.asp")
Set conn= Server.CreateObject("ADODB.Connection")
p1=Provider&Path
conn.Open P1
c_path="/count" '设置安装目录,如/count
dim visiter
dim sql
dim rs
sql="select visiter from visiter"
set rs=conn.execute(sql)
count=rs("visiter")
soonhostcomlen=len(count)
for i=1 to soonhostcomlen
str=str+"mid(count,i,1)"
next
sql="update visiter set visiter=visiter+1"
rs.close
set rs=nothing
conn.execute(sql)
conn.close
set conn=nothing
return str
End function
%>
我要把这个函数用到本文件中的另外一个函数FOOT()函数中,STR就是要返回的变量.
FOOT()函数如下
'==================================
'=过 程 名:foot
'=功 能:页面脚部信息显示
'==================================
sub foot()
dim javastr
javastr="000000"
rem javastr=countt(javastr)
rem call countt(javastr)
rem <script src="countt(javastr)"></script>
m_foot=replace(m_foot,"$weburl$",weburl)
m_foot=replace(m_foot,"$webname$",webname)
m_foot=replace(m_foot,"$webemail$",webemail)
m_foot=replace(m_foot,"$sitebuild$",sitebuild)
m_foot=replace(m_foot,"]</span>","")
m_foot=replace(m_foot,"$webstyle$",mb_name&"您是第"&javastr&"位访问者" &"]</span>  <a href=""Counter/show.asp"" target=""_blank"">查看访问量统计</a><br>")
m_foot=replace(m_foot,"$webboss$",webboss)
sql="select url,title,target,name from Ft_menu where items=0 and navwz=0 and shown=true"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
footurl=rs(0)
foottitle=rs(1)
foottarget=rs(2)
footname=rs(3)
footmenu=footmenu+"<a href="&footurl&" title="&foottitle&" target="&foottarget&">"&footname&"</a> | "
rs.movenext
loop
footmenu=replace(footmenu,"_self>静音版","_top>静音版")
else
footmenu="欢迎使用学校网站管理系统"
end if
rs.close:set rs=nothing
if right(footmenu,7)="| " then
footmenu=left(footmenu,len(footmenu)-7)
end if
m_foot=replace(m_foot,"{$footmenu}",footmenu)
response.write m_foot
CloseDatabase
end sub
其中的程序是我改过的,可是不能用,请各位大虾侃侃问题在哪里.谢了.