编写一个ASP程序,实现并显示当前网页的在线人数和计数器 10
有人给出如下答案!我不懂ASP编程。请高人解释一下该保存成什么才能正确调适!谢谢了<%Subsession_onstartApplication.lockApplicat...
有人给出如下答案!我不懂ASP编程。请高人解释一下该保存成什么才能正确调适!谢谢了
<%
Sub session_onstart
Application.lock
Application("online") = Application("online") + 1
Application.unlock
End sub
Sub session_onend
Application.lock
Application("online") = Application("online") - 1
End sub
%>
<html>
<body>
<% session.timeout = 5%>
<P>在线人数:<% = Application("onlive") %> </P>
</body>
</html>
<% counter = Application("counter") + 1 %>
<html><body>是第<%counter%>位访客
<%Application("counter") = counter %>
</body></html> 展开
<%
Sub session_onstart
Application.lock
Application("online") = Application("online") + 1
Application.unlock
End sub
Sub session_onend
Application.lock
Application("online") = Application("online") - 1
End sub
%>
<html>
<body>
<% session.timeout = 5%>
<P>在线人数:<% = Application("onlive") %> </P>
</body>
</html>
<% counter = Application("counter") + 1 %>
<html><body>是第<%counter%>位访客
<%Application("counter") = counter %>
</body></html> 展开
展开全部
在网站的根目录下,新建global.asa
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub session_onstart
Application.lock
Application("online") = Application("online") + 1
Application.unlock
End sub
Sub session_onend
Application.lock
Application("online") = Application("online") - 1
End sub
</SCRIPT>
在其他页面中显示就可以了,如下
<html>
<body>
<% session.timeout = 5%>
<P>在线人数:<% = Application("onlive") %> </P>
</body>
</html>
<% counter = Application("counter") + 1 %>
<html><body>是第<%counter%>位访客
<%Application("counter") = counter %>
</body></html>
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub session_onstart
Application.lock
Application("online") = Application("online") + 1
Application.unlock
End sub
Sub session_onend
Application.lock
Application("online") = Application("online") - 1
End sub
</SCRIPT>
在其他页面中显示就可以了,如下
<html>
<body>
<% session.timeout = 5%>
<P>在线人数:<% = Application("onlive") %> </P>
</body>
</html>
<% counter = Application("counter") + 1 %>
<html><body>是第<%counter%>位访客
<%Application("counter") = counter %>
</body></html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询