The time value of the receiving object. This will be an integer that represents the time in milliseconds since the time origin at midnight on January the first, 1970.
This method returns the time value of the receiving object.
<!-- Hand and eye coordination and reaction timer --> <HTML> <HEAD></HEAD> <BODY> <DIV ID="ONE" STYLE="background-color:YELLOW"> Click button 1 then button two as quickly as you can </DIV> <FORM> <INPUT TYPE="button" VALUE="1" onClick="clickMe1()"> <INPUT TYPE="button" VALUE="2" onClick="clickMe2()"> </FORM> <SCRIPT> function clickMe1() { myDate1 = new Date(); myTime1 = myDate1.getTime(); } function clickMe2() { myDate2 = new Date(); myTime2 = myDate2.getTime(); document.all.ONE.innerText = (myTime2 - myTime1) + " Milliseconds"; } </SCRIPT> </BODY> </HTML>
See also: | Date.prototype, Date.setTime() |
Prev | Home | Next |
Date.getSeconds() | Up | Date.getTimezoneOffset() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |