timeStamp Event Property - Javascript DOM

Javascript examples for DOM:Event

Description

The timeStamp event property when the event occured.

Return Value

A Number, representing the number of milliseconds since midnight of January 1, 1970

The following code shows how to get the number of milliseconds since midnight of January 1, 1970:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p onclick="myFunction(event)">Click this paragraph.</p>

<p>Timestamp: <span id="demo"></span></p>

<script>
function myFunction(event) {//from w  w w  . j  ava 2 s  .  com
    var n = event.timeStamp;
    document.getElementById("demo").innerHTML = n;
}
</script>

</body>
</html>

Related Tutorials