在靜態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()
%>
<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