timeStampEvent Property

事件对象参考手册Event Object

Definition and Usage

The timeStamp event property returns a timestamp, indicating the date and time when the event occurred (milliseconds since the epoch).

The epoch is an event reference point. Here, it is the time when the client started.

Not all systems provide this information; therefore, the timeStamp property is not available for all systems/events.

Syntax

event.timeStamp
 

Example

Example

The following example gets the event timestamp since system startup:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example (example.com)</title>
<script>
function myFunction(e){
    alert(e.timeStamp);
}
</script>
</head>
<body>

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

</body>
</html>

Try it Yourself »


事件对象参考手册Event Object Other Extensions