用多种方法制作WEB页面的计数器
敬业的IT人
互联网
佚名
2008-4-14 16:53:05
One way to do it:
Do you like to know how many users visited your site? Creating a Web counter is very easy thing to do
using ASP. The%>
<HTML>
<HEAD>
<TITLE>Counter Example 1</TITLE>
</HEAD>
<BODY>
<H1> You are the visitor number <%=Application("count")%></H1>
</BODY>
</HTML>
Another way to do it:
Ok that’s very nice, but what will happen if the application stops for any reason? You will lose all the
data stored in the application variables and that includes the count variable. To solve this problem I
will use another way, you need to store the value of the count variable with in a text file or database.
For me I prefer database so I will use an MS access(小型网站之最爱) database with a table ofcounter.mdb"))
Connection.Open ConStr
' Create the record set and retrive the counter value
Set RS = Connection.Execute("SELECT * FROM count")
' Increase the counter value bycontentad">
and when a session ends we will decrease it by RUNAT="Server">
Sub Application_OnStart
'Create the variable that will hold the number of active visitors
Application("Active") = 0
End Sub
Sub Session_OnStart
'Increase the counter by>
Do you like to know how many users visited your site? Creating a Web counter is very easy thing to do
using ASP. The%>
<HTML>
<HEAD>
<TITLE>Counter Example 1</TITLE>
</HEAD>
<BODY>
<H1> You are the visitor number <%=Application("count")%></H1>
</BODY>
</HTML>
Another way to do it:
Ok that’s very nice, but what will happen if the application stops for any reason? You will lose all the
data stored in the application variables and that includes the count variable. To solve this problem I
will use another way, you need to store the value of the count variable with in a text file or database.
For me I prefer database so I will use an MS access(小型网站之最爱) database with a table ofcounter.mdb"))
Connection.Open ConStr
' Create the record set and retrive the counter value
Set RS = Connection.Execute("SELECT * FROM count")
' Increase the counter value bycontentad">
and when a session ends we will decrease it by RUNAT="Server">
Sub Application_OnStart
'Create the variable that will hold the number of active visitors
Application("Active") = 0
End Sub
Sub Session_OnStart
'Increase the counter by>
- 最新文章
- 用ASP发 WAP MAIL(-)[04-14]
- bbs树形结构的实现方法(一)[04-14]
- bbs树型结构的实现方法(二)[04-14]
- 用ASPMail组件实现E_mail自动反馈[04-14]
- HTTP方式上载文件的ASP程序实例[04-14]
- 用ASP统计用户在站点的停留时间(1)[04-14]
- 相关文章
- bbs树形结构的实现方法(一)[04-14]
- bbs树型结构的实现方法(二)[04-14]
- 利用ASP制作EXECL报表方法(一)[04-14]
- 利用ASP制作EXECL报表方法(二)[04-14]
- 简单的加密方法:XOR[04-14]
- 限制只能中文输入的方法[04-14]
