<table border="0">
<form name="d">
<tr>
<td align="center"><font face="Arial"><strong>tempo em segundos:</strong></font></td>
<td align="center">
<p><input type="text" size="8" name="d2"></p>
</td>
</tr>
<input type="button" name="startstop" value="start!" onClick="start()" />
</form>
</table>
<script>
var milisec=0;
var seconds=0;
document.d.d2.value='0';
function start() {
if (milisec>=9){
milisec=0;
seconds+=1;
}
else{
milisec+=1;
}
contador = seconds+"."+milisec;
document.d.d2.value= seconds+"."+milisec;
tt = setTimeout(function(){start()},100);
document.d.startstop.value = "stop!";
document.d.startstop.onclick = stopp;
}
function stopp()
{
document.d.startstop.value = 'clear!';
document.d.startstop.onclick = clear;
clearTimeout(tt);
}
function clear()
{
clearTimeout(milisec);
clearTimeout(seconds);
clearTimeout(contador);
document.d.d2.value='000';
document.d.startstop.value = 'start!';
document.d.startstop.onclick = start;
}
</script>