Write it casually! Bored! If the Code has bugs, you are welcome to make a strong shot!
JS CODE
Copy codeThe Code is as follows:
<Script type = "text/javascript" language = "javascript">
// Total time, divided into units
Var time = 100;
// Hour
Var h = parseInt (time/60)> 0? ParseInt (time/60): 0;
// Minute
Var m = time % 60;
// Second
Var s = 60;
// Output the Dom position to the current Script
Document. write ('<span> remaining <font id = "f_hh">' + h + '</font> hour <font id = "f_mm">' + m + '</ font> minute <font id = "f_ss"> '+ s +' </font> second </span> ');
// Start execution countdown
Var timeInterval = setInterval (function (){
// If the time, minute, and second are all 0, the current countdown will be stopped.
If (h = 0 & m = 0 & s = 0) {clearInterval (timeInterval); return ;}
// When the second reaches 0, it is 60 seconds again
If (s = 0) {s = 60 ;}
If (s = 60 ){
// Every time the second reaches 60 seconds, the minute minus one
M-= 1;
// When the minute is equal to 0 and the hour is more than one hour, go in and check it out.
If (m = 0 & h> 0 ){
// Subtract one hour
H-= 1;
// The default value is 60 minutes.
M = 60;
// The default value is 60 seconds.
S = 60;
}
}
// Continue to beat in seconds, minus one
S-= 1;
// Hourly value assignment
Document. getElementById ('f _ hh'). innerHTML = h;
// Minute value assignment
Document. getElementById ('f _ mm'). innerHTML = m;
// Second value assignment
Document. getElementById ('f _ ss'). innerHTML = s;
},1000 );
</Script>
HTML CODE
Copy codeThe Code is as follows:
<Html>
<Head>
<Title> Date Demo </title>
</Head>
<Body>
<Script type = "text/javascript" language = "javascript">
// Total time, divided into units
Var time = 100;
// Hour
Var h = parseInt (time/60)> 0? ParseInt (time/60): 0;
// Minute
Var m = time % 60;
// Second
Var s = 60;
// Output the Dom position to the current Script
Document. write ('<span> remaining <font id = "f_hh">' + h + '</font> hour <font id = "f_mm">' + m + '</ font> minute <font id = "f_ss"> '+ s +' </font> second </span> ');
// Start execution countdown
Var timeInterval = setInterval (function (){
// If the time, minute, and second are all 0, the current countdown will be stopped.
If (h = 0 & m = 0 & s = 0) {clearInterval (timeInterval); return ;}
// When the second reaches 0, it is 60 seconds again
If (s = 0) {s = 60 ;}
If (s = 60 ){
// Every time the second reaches 60 seconds, the minute minus one
M-= 1;
// When the minute is equal to 0 and the hour is more than one hour, go in and check it out.
If (m = 0 & h> 0 ){
// Subtract one hour
H-= 1;
// The default value is 60 minutes.
M = 60;
// The default value is 60 seconds.
S = 60;
}
}
// Continue to beat in seconds, minus one
S-= 1;
// Hourly value assignment
Document. getElementById ('f _ hh'). innerHTML = h;
// Minute value assignment
Document. getElementById ('f _ mm'). innerHTML = m;
// Second value assignment
Document. getElementById ('f _ ss'). innerHTML = s;
},1000 );
</Script>
</Body>
</Html>