timeStamp 事件屬性
定義和用法
timeStamp 事件屬性可返回一個(gè)時(shí)間戳。指示發(fā)生事件的日期和時(shí)間(從 epoch 開(kāi)始的毫秒數(shù))。
epoch 是一個(gè)事件參考點(diǎn)。在這里,它是客戶機(jī)啟動(dòng)的時(shí)間。
并非所有系統(tǒng)都提供該信息,因此,timeStamp 屬性并非對(duì)所有系統(tǒng)/事件都是可用的。
語(yǔ)法
event.timeStamp
實(shí)例
下面的例子可獲得系統(tǒng)啟動(dòng)開(kāi)始的事件戳:
<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
- 返回系統(tǒng)啟動(dòng)至今的分鐘數(shù)(IE 瀏覽器不支持)。