time_count.html
Dosyayı İndir
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var isFinish=false;
function start(hour,minute,second){
if(!isFinish){
if(hour==0&&minute==0&&second==0){
isFinish=true;
finish();
}else{
if(second>0){
second--;
}else{
second=59;
if(minute>0){
minute--;
}else{
minute=59;
hour--;
}
}
setValue(hour,minute,second);
setTimeout("start("+hour+","+minute+","+second+")",1000);
}
}
}
function finish(){
alert("Zaman Doldu");
}
function setValue(hour,minute,second){
var textField=this.document.test.CronometerText;
textField.value=getWithZero(hour)+":"+getWithZero(minute)+":"+getWithZero(second);
}
function getWithZero(number){
if(number<10){
return "0"+number;
}else{
return number;
}
}
</SCRIPT>
</head>
<body onLoad="start(1,30,0)">
<form name="test">
<input type="text" name="CronometerText" size="10"></input>
</form>
</body>
</html>
Dosyayı İndir