[Html]
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Script type = "text/javascript">
Var t www.2cto.com
Function timedCount ()
{
StartTime ();
}
Function startTime ()
{
Var today = new Date ()
Var h = today. getHours ()
Var m = today. getMinutes ()
Var s = today. getSeconds ()
Var MS = today. getMilliseconds ()
// Add a zero in front of numbers <10
M = checkTime (m)
S = checkTime (s)
MS = Math. floor (checkTime (MS)/100)
Document. getElementById ('txt '). value = h + ":" + m + ":" + s + ":" + ms
T = setTimeout ('starttime () ', 100)
}
Function checkTime (I)
{
If (I <10)
{I = "0" + I}
Return I
}
Function stopCount ()
{
ClearTimeout (t)
}
Function isKeyPressed (event)
{
If (event. ctrlKey = 1)
{
StartTime ();
}
If (event. shiftKey = 1)
{
StopCount ()
}
}
</Script>
</Head>
<Body onkeydown = "isKeyPressed (event)">
<Form>
<Input type = "button" value = "start timing! "OnClick =" timedCount () ">
<Input type = "text" id = "txt">
<Input type = "button" value = "Stop timing! "OnClick =" stopCount () ">
</Form>
<P>
Click the start timer button above. The input box starts timing from 0. Click "Stop timing" to stop timing.
</P>
</Body>
</Html>