Summary: JavaScript implements a simple countdown function
<!doctype html>
<meta charset= "UTF-8" >
<meta name= "Generator" content= "editplus®" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<title>javascript-Countdown (a) </title>
<script type= "Text/javascript" >
var nowtime=new Date ();
var setmin=0;
function Time () {
var Min=document.getelementbyid ("Shi"). Value;
var setmin=min*60*1000;
var endtime=nowtime.gettime () +setmin;
var stime=endtime-new Date (). GetTime ();
var h=0;
var m=0;
var s=0;
if (stime>=0) {
//Time and seconds calculation method (key point)
H=math.floor (stime/1000/60/60%24);
M=math.floor (STIME/1000/60%60);
S=math.floor (STIME/1000%60);
}
document.write (H + ":" +m+ ":" +s);
document.getElementById ("T_h"). InnerHTML = Check (h) + "when";
document.getElementById ("T_m"). InnerHTML = Check (m) + "minute";
document.getElementById ("t_s"). InnerHTML = Check (s) + "SEC";
}
function Ji () {
SetInterval (time,0);//Key points
//}
function Check (e) {
if (e<10) {
E= "0" +e;
return e;
}else{
return e;
}
}
</script>
<body>
<input type= "text" value= "0" id= "shi" style= "height:30px;width:45px;text-align:center;" /> minutes <br/>
<!--<button onclick= "Ji ()" style= "height:30px;" > Timing </button>-->
<div id= "Show" >
<span id= "T_h" >00 </span>
<span id= "T_m" >00 points </span>
<span id= "t_s" >00 sec </span>
</div>
</body>
2016-04-17 javascript-Countdown