mozilla
Your Search Results

    Event.timeStamp

    Summary

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

    Syntax

    event.timeStamp
    

    Examples

    var number = event.timeStamp;
    

    The following is a more complete example:

    <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

    Document Tags and Contributors

    Last updated by: fscholz,