网乐原科技

直播中

news center新闻中心
首页 > 资讯中心 > 软件技术

显示访问者停留时间

发布时间:2008-08-01     阅读数: 次       来源:网乐原科技
在你html文件的<head>与</head>之间加上:
<script LANGUAGE="JAVASCRIPT"> <!-- var ap_name = navigator.appName; var ap_vinfo = navigator.appVersion; var ap_ver = parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf('('))); var time_start = new Date(); var clock_start = time_start.getTime(); var dl_ok=false; function init () { if(ap_name=="Netscape" && ap_ver>=3.0) dl_ok=true; return true; } function get_time_spent () { var time_now = new Date(); return((time_now.getTime() - clock_start)/1000); } function show_secs () // show the time user spent on the side { var i_total_secs = Math.round(get_time_spent()); var i_secs_spent = i_total_secs % 60; var i_mins_spent = Math.round((i_total_secs-30)/60); var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent); var s_mins_spent = "" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent); document.time.time_spent.value = s_mins_spent + ":" + s_secs_spent; window.setTimeout('show_secs()',1000); } --> </script>

在你html文件的<body>改为:
<body onLoad="init(); window.setTimeout('show_secs()',1);">

在你html文件的<body>与</body>之间加上:
<form name="time" onSubmit="0"> <p>你的停留時间为:<br> <input type="text" name="time_spent" size="7" onFocus="this.blur()" BGCOLOR="#FFFFCC"> </form>

网乐原科技

客服热线:0771-5761507

QQ:53290011

QQ邮箱:53290011@qq.com

工作时间:周一到周五 9:00-18:00

地址:广西南宁市江南万达写字楼C16栋1309室

物联网开发

关注我们

微信小商店 腾讯QQ客服 微信客服