Visit Mozilla.org

DOM:event.timeStamp

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

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

[edit] Syntax

number = event.timeStamp

[edit] Example

<html>
<head>

<title>timeStamp example</title>

<script type="text/javascript">
var curr_time = null;

function getTime(evt) {
  curr_time = evt.timeStamp;
  document.getElementById("time").firstChild.nodeValue = curr_time;
}
</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>

[edit] Notes

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

[edit] Specification

timestamp