在静态的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 subprivate sub openconn()
set conn = server.createobject("adodb.connection")
conn.open connstr
end subid = 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.closeset rs = nothing
call closeconn()
%><script language="网页特效">
parent.news_hits.innerhtml = "<%=hits%>";
</script>
在html中调用方法
<script lanaguge='javascript' src=/hits.asp?id=1></script> 其它的文章id是你在生成静态页面时给的
注明:本站原创教程,转载注明来源于http://www.111cn.nethttp://www.111cn.net/asp/asp.html