在news.asp中加入下面代码:
浏览次数: <SCRIPT language='javascript' src="../../asptohtml/counters.asp?id=<%=rs("id")%>"></SCRIPT>
生成静态页面后:
浏览次数: <SCRIPT language='javascript' src="../../asptohtml/counters.asp?id=730"></SCRIPT>
counters.asp文件代码:
程序代码
<!--#include file="conn.asp" -->
<%
ID = Trim(Request.QueryString("ID"))
Set rs = Server.CreateObject("Adodb.Recordset")
Sql = "select new_hits from News where ID=" & ID
rs.open sql,conn,1,3
rs("new_hits") = rs("new_hits") + 1
rs.update
hits = rs("new_hits")
%>
'输出文章浏览次数
document.write("<%=hits%>")