zoukankan      html  css  js  c++  java
  • php 计算该用户IP在网页停留的时间

    查看当前用户在网页上停留的时间

    <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() 
    {
    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.fmO.time_spent.value = s_mins_spent + ":" + s_secs_spent;
    window.setTimeout('show_secs()',1000);
    }
    </script>

    <body onLoad="init();window.setTimeout('show_secs()',1);">
    <form name="fmO" onSubmit="0"><font color="#6060FF">停留时间:</font><input type="text" name="time_spent" size=7 onFocus="this.blur()">
    <input type="submit" value="提交"></form>

  • 相关阅读:
    mysql 的安装
    nginx的安装
    修改网站默认目录
    配置yum仓库 安装httpd服务
    安装 VMware Tools
    phpstrom + xdebug 断点调试
    公网IP访问服务器
    mysql in操作和find_in_set函数
    网页授权有时候获取不到openid 的坑
    解决Required Integer parameter 'id' is not present的一种方法
  • 原文地址:https://www.cnblogs.com/yuemengke/p/3385998.html
Copyright © 2011-2022 走看看