一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp实现静态页面浏览次数统计代码

时间:2010-11-30 编辑:简简单单 来源:一聚教程网

在静态的html页面中要实现文章浏览次数的统计,可以进行js来调用asp教程文件带参数来实现,下面是我写的一款asp实现静态页面点击次数的代码。

<%
dim conn,connstr,rs
connstr = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(dbdns & syssitedbpath)

call openconn()

set rs = server.createobject("adodb.recordset")

private sub closeconn()
 conn.close
 set conn = nothing
end sub

private sub openconn()
 set conn = server.createobject("adodb.connection")
 conn.open connstr
end sub

id = cdbl(request.querystring("id"))
sql="select id,hits from ok3w_article where id=" & id
rs.open sql,conn,1,3
rs("hits") = rs("hits") + 1
rs.update
hits = rs("hits")
rs.close

set rs = nothing
call closeconn()
%>

在html中调用方法

其它的文章id是你在生成静态页面时给的

注明:本站原创教程,转载注明来源于http://www.111com.net/asp/asp.html

热门栏目