如何计算用户的在线时间

SadEmprie 2003-03-26 09:07:00
希望能计算用户总共的在线时间,以分钟为单位,如何实现呢?
各位帮帮忙~~~
...全文
81 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
layewong 2003-03-26
  • 打赏
  • 举报
回复
Sub Session_onStart()
Set Session(“start_time”) = cstr(now)
End Sub

Sub Session_onEnd()
Set Session(“end_time”) = cstr(now)
End Sub
session("end_time")-session("start_time")
SadEmprie 2003-03-26
  • 打赏
  • 举报
回复
thanks a lot
fason 2003-03-26
  • 打赏
  • 举报
回复
<html>
<head>
<script language="javascript">
<!--
var clock=new Date(); //when the visitor enter to the site the clock start working
var startTime=clock.getTime();
function showTime() //when the visitor out from the site start calculate the time
//he was in the site
{
var leaveTime=new Date();
var totalTime=((leaveTime.getTime()-startTime)/1000); //total time in seconds
var hTimerLast=Math.floor(totalTime/3600); //check hours
var mTimerLast=Math.floor((totalTime%3600)/60); //check minutes
var sTimerLast=Math.floor(totalTime%60); //check seconds
alert("You had been at the site for: "+hTimerLast+" Hours "+mTimerLast+" Minutes "+sTimerLast+
" Seconds .");
}
//-->
</script>
</head>
<body onunload="showTime()">
</body>
</html>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧