JSストップウォッチタイマ(スタート、ストップ、クリア)

<HTML>

<HEAD>
<スクリプトタイプ= "テキスト/ javascriptの">
VAR C = 0
VAR T

関数timedCount()
 {

 のdocument.getElementById( 'TXT')。値= C
 、C = C + 1
 T =たsetTimeout( "timedCount ()」、1000)
 }

関数stopCount()
 {
    
     てclearTimeout(T)
    
 }
関数CS()
{
 
     C = 0  
     のdocument.getElementById( 'TXT')。値= 0
     
}
 
</ SCRIPT>
</ head>

<body>
<フォーム>
の<input type = "ボタン"値= "开始!" ID = "開始"のonClick = "timedCount()">
の<input type = "テキスト" ID = "TXT">
< 入力タイプ=「ボタン」値=「停止!」ID = "終了" のonClick = "stopCount()">
<INPUT TYPE = "ボタン"値= "清零!" ID = "SS"のonClick = "CS()">
</ FORM>
</ BODY>

</ HTML>

おすすめ

転載: www.cnblogs.com/0826sw/p/11915283.html