blob: 3e877af22bd996dda3fb65c37276e8881b6c75d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
---
title: event.timeStamp
slug: Web/API/Event/timeStamp
tags:
- API
- DOM
- Event
- timeStamp
translation_of: Web/API/Event/timeStamp
---
<div>{{APIRef}}</div>
<div> </div>
<div class="warning"><strong>警告:</strong> 在Gecko中,该属性的值不是事件发生时正确的事件戳.查看 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=238041" title="https://bugzilla.mozilla.org/show_bug.cgi?id=238041">https://bugzilla.mozilla.org/show_bug.cgi?id=238041</a></div>
<h3 id="Summary" name="Summary">概述</h3>
<p>返回事件发生时的时间戳.</p>
<h3 id="Syntax" name="Syntax">语法</h3>
<pre class="eval" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.286em; margin-left: 0px; padding-top: 15px; padding-right: 15px; padding-bottom: 15px; padding-left: 15px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; background-clip: initial; background-color: rgb(246, 246, 242); font: normal normal normal 100%/normal 'Courier New', 'Andale Mono', monospace;"><em>var number</em> = event.timeStamp;
</pre>
<h3 id="Syntax" name="Syntax">例子</h3>
<pre class="brush: html"><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>
</pre>
<h3 id="Notes" name="Notes">备注</h3>
<p>此属性仅适用于事件系统支持该属性的特定事件类型.</p>
<h3 id="Specification" name="Specification">规范</h3>
<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-Event-timeStamp">event.timestamp</a></p>
|