ASP implementation of static page browsing count code

Source: Internet
Author: User
Tags html page

In the static HTML page to achieve the statistics of the number of browsing, you can do JS to invoke the ASP tutorial file with parameters to achieve, the following is an ASP I wrote the number of static page clicks code.

<%
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= "Web Effects" >
parent.news_hits.innerhtml = "<%=hits%>";
</script>

Calling methods in HTML

<script lanaguge= ' JavaScript ' src=/hits.asp?id=1></script> other article IDs are given when you generate a static page

Note: Original site tutorial, reproduced annotated from http://www.111cn.nethttp://www.111cn.net/asp/asp.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.