<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en"
<title> New D Ocument </title>
<body>
<form action= "somepage.asp"
<input type= " Text "value=" 0 "name=" txt1 "/>
<input type=" button "value=" Start "name=" Btnstart "/>
<input type=" Button "value=" reset "name=" btnreset/>
</form>
</body>
<script language = "JavaScript" type= "Text/javascript"
<!--
//Get form field
var txt=document.forms[0].elements["Txt1" in the form ;
var btnstart=document.forms[0].elements["Btnstart"];
var btnreset=document.forms[0].elements["btnreset"]
//Defines the timer's ID
var ID;
////10 milliseconds to increase the value by 1
Var seed=0;
Btnstart.onclick=function () {
To determine the current operation based on the button text
if (this.value== "start") {
Make button text stop
This.value= "Stop";
Make the reset button unavailable
Btnreset.disabled=true;
Set timer, jump once every 0.01 seconds
Id=window.setinterval (tip,10);
}else{
Change the button text to start
This.value= "Start";
Make the reset button available
Btnreset.disabled=false;
Cancel Timing
Window.clearinterval (ID);
}
}
Reset button
Btnreset.onclick=function () {
Seed=0;
}
Let the stopwatch jump a grid
Function Tip () {
seed++;
txt.value=seed/100;
}
-->
</script>