Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

event.timeStamp

 
警告: 在Gecko中,该属性的值不是事件发生时正确的事件戳.查看 https://bugzilla.mozilla.org/show_bug.cgi?id=238041

概述

返回事件发生时的时间戳.

语法

var number = event.timeStamp;

例子

<html>
<head>

<title>timeStamp example</title>

<script type="text/javascript">
function getTime(event) {
  document.getElementById("time").firstChild.nodeValue = event.timeStamp;
}
</script>
</head>

<body onkeypress="getTime(event)">

<p>按下任意键获取onkeypress事件对象的timestamp属性值.</p>
<p>timeStamp: <span id="time">-</span></p>

</body>
</html>

备注

此属性仅适用于事件系统支持该属性的特定事件类型.

规范

event.timestamp

文档标签和贡献者

 此页面的贡献者: teoli, arunpandianp, ziyunfei
 最后编辑者: arunpandianp,