js 스톱워치 타이머

2034 단어 타이머
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
var c=0
var t
function timedCount()
{
   var temptextmin=document.getElementById('txt');
	hour = parseInt(c / 3600);//    
	min = parseInt(c / 60);//    
	if(min>=60){
	    min=min%60
	}
	lastsecs = c % 60;


temptextmin.value = hour + " " + min + " " + lastsecs + " "

c=c+1
t=setTimeout("timedCount()",1000)
document.getElementById('start').style.display = "none";   
document.getElementById('end').style.display = ""; 


}

function stopCount()
{
clearTimeout(t)
document.getElementById('start').style.display = "";   
document.getElementById('end').style.display = "none"; 
}
function clearAll(){
 c=0
 document.getElementById('txt').value=  "0 " +  "0 " + "0 "
 clearTimeout(t)
 document.getElementById('start').style.display ="";   
 document.getElementById('end').style.display = "none"; 
}
</script>
</head>

<body>

<form>
<input type="text" id="txt" value="0 0 0 ">
<input type="button" value="    !" id="start" onClick="timedCount()">
<input type="button" value="    !" style="display: none" id="end" onClick="stopCount()">
<input type="button" value="  " onClick="clearAll()">
</form>

<p>      “    ”        。          ,  0   。  “    ”        。</p>

</body>

</html>

좋은 웹페이지 즐겨찾기