timeStamp 事件属性


定义和用法

timeStamp 事件属性可返回一个时间戳。指示发生事件的日期和时间(从 epoch 开始的毫秒数)。

epoch 是一个事件参考点。在这里,它是客户机启动的时间。

并非所有系统都提供该信息,因此,timeStamp 属性并非对所有系统/事件都是可用的。

语法

  1. event.timeStamp
 

实例

实例

下面的例子可获得系统启动开始的事件戳:

  1. <html>
    <head>
    <script>
    function myFunction(e)
      {
      alert(e.timeStamp);
      }
    </script>
    </head>

    <body>

    <p onclick="myFunction(event)">Click this paragraph. An alert
    box will alert the timestamp.</p>

    </body>
    </html>
运行一下 »