XML DOM timeStamp 事件屬性

定義和用法

timeStamp 事件屬性可返回一個時間戳。指示發生事件的日期和時間(從 epoch 開始的毫秒數)。

epoch 是一個事件參考點。在這里,它是客戶機啟動的時間。

并非所有系統都提供該信息,因此,timeStamp 屬性并非對所有系統/事件都是可用的。

語法

event.timeStamp

實例

下面的例子可獲得系統啟動開始的事件戳:

<html>
<head>
<script type="text/javascript">
function showTimestamp(event)
  {
  var minutes = 1000*60
  x=event.timeStamp;
  alert(x/minutes)
  }
</script>
</head>
<body onmousedown="showTimestamp(event)">
<p>Click in the document. An alert 
box will alert the timestamp.</p>
</body>
</html>

TIY

timestamp event
返回系統啟動至今的分鐘數(IE 瀏覽器不支持)。