<!doctype html> |
|
lang= "en" > |
|
|
|
<meta charset= "UTF-8" > |
|
<meta name= "Generator" content= "editplus®" > |
|
<meta name= "Author" content= "" > |
|
<meta name= "Keywords" content= "" > |
|
<meta name= "Description" content= "" > |
|
<title>document</title> |
|
<script type= "text/javascript" > |
|
var c=0 |
|
var t |
|
function Timedcount () |
|
{ |
|
document.getElementById (' txt '). value=c |
|
C=c+1 |
|
T=settimeout ("Timedcount ()", 1000) |
|
} |
|
function Stopcount () |
|
{ |
|
|
|
SetTimeout ("document.getElementById (' txt '). Value=0", 0); |
|
Cleartimeout (t); |
|
} |
|
function Restopcount () |
|
{ |
|
|
|
SetTimeout ("document.getElementById (' txt '). Value=c", 0); |
|
Cleartimeout (t); |
|
} |
|
</script> |
|
|
|
|
|
<body> |
|
|
|
<form> |
|
<input type= "button" value= " start/re-timer!" " onclick="timedcount () "> |
|
<input type= "button" value= " stop timing! " onclick="stopcount () "> |
|
<input type= "text" id= "txt" > |
|
<input type= "button" value= " Pause the Timer! " onclick="restopcount () "> |
|
</form> |
|
</body> |
|
|
Implement stopwatch timer with settimeout setinterval (Start/pause stop timings)