event.timeStamp

  • Revision slug: DOM/event.timeStamp
  • Revision title: event.timeStamp
  • Revision id: 23679
  • Created:
  • Creator: Matej Lednar
  • Is current revision? No
  • Comment 1 words added, 2 words removed

Revision Content

{{ DomRef() }}

Summary

Returns the time (in milliseconds since the epoch) that the event was created.

Syntax

event.timeStamp

Examples

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>Press any key to get the current timestamp
for the onkeypress event.</p>
<p>timeStamp: <span id="time">-</span></p>

</body>
</html>

Notes

This property only works if the event system supports it for the particular event.

Specification

timestamp

{{ languages( { "pl": "pl/DOM/event.timeStamp" } ) }}

Revision Source

<p>{{ DomRef() }}</p>
<h3 name="Summary">Summary</h3>
<p>Returns the time (in milliseconds since the epoch) that the event was created.</p>
<h3 name="Syntax">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; border-top-color: rgb(203, 200, 185); border-right-color: rgb(203, 200, 185); border-bottom-color: rgb(203, 200, 185); border-left-color: rgb(203, 200, 185); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(246, 246, 242); overflow-x: auto; overflow-y: auto; font: normal normal normal 100%/normal 'Courier New', 'Andale Mono', monospace; background-position: initial initial; background-repeat: initial initial; ">event.timeStamp
</pre>
<h3 name="Syntax">Examples</h3>
<pre class="eval"><em>var number</em> = event.timeStamp;
</pre>
<p> </p>
<pre>&lt;html&gt;
&lt;head&gt;

&lt;title&gt;timeStamp example&lt;/title&gt;

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

&lt;body onkeypress="getTime(event)"&gt;

&lt;p&gt;Press any key to get the current timestamp
for the onkeypress event.&lt;/p&gt;
&lt;p&gt;timeStamp: &lt;span id="time"&gt;-&lt;/span&gt;&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3 name="Notes">Notes</h3>
<p>This property only works if the event system supports it for the particular event.</p>
<h3 name="Specification">Specification</h3>
<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-Event-timeStamp">timestamp </a></p>
<p>{{ languages( { "pl": "pl/DOM/event.timeStamp" } ) }}</p>
Revert to this revision