Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Event.timeStamp

說明

回傳事件建立的時間(單位是毫秒;從 epoch 開始計算)。

Syntax

event.timeStamp

範例

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>

注意

這個 property 僅在瀏覽器支持該事件才會有用。

詳細資料

文件標籤與貢獻者

 此頁面的貢獻者: Shiyou
 最近更新: Shiyou,