Write casually! Idle, bored! If the code has bugs, you are welcome to make a strong shot of bricks!
JS CODE
Copy Code code as follows:
<script type= "Text/javascript" language= "JavaScript" >
Total time, divided into units
var time = 100;
Hours
var h = parseint (TIME/60) > 0? parseint (TIME/60): 0;
Part
var m = time% 60;
Seconds
var s = 60;
Output to the DOM position of the current script
document.write (' <span> remaining <font id= "f_hh" > ' + H + ' </font> hour <font id= "f_mm" > ' + M + ' </font> Split <font id= "F_SS" > ' + S + ' </font> sec </span> ');
Start the countdown
var timeinterval = setinterval (function () {
If the time, minutes, and seconds are 0 o'clock, the current countdown will be stopped
if (h = = 0 && m = = 0 && s = = 0) {clearinterval (timeinterval);
When the seconds go to 0 o'clock, again for 60 seconds
if (s = = 0) {s = 60;}
if (s = = 60) {
Every time when the seconds go to 60 seconds, minutes minus one
M-= 1;
When the score equals 0 o'clock and the hour is 1 hours away, go inside and check it out.
if (m = = 0 && h > 0) {
Hour minus One
H-= 1;
Minutes automatically defaults to 60 points
m = 60;
seconds automatically defaults to 60 seconds
s = 60;
}
}
Seconds continue to beat, minus a
S-= 1;
Hour assignment
document.getElementById (' f_hh '). InnerHTML = h;
Minute assignment
document.getElementById (' f_mm '). InnerHTML = m;
Seconds Assignment
document.getElementById (' F_ss '). InnerHTML = S;
}, 1000);
</script>
HTML CODE
Copy Code code as follows:
<title>date demo</title>
<body>
<script type= "Text/javascript" language= "JavaScript" >
Total time, divided into units
var time = 100;
Hours
var h = parseint (TIME/60) > 0? parseint (TIME/60): 0;
Part
var m = time% 60;
Seconds
var s = 60;
Output to the DOM position of the current script
document.write (' <span> remaining <font id= "f_hh" > ' + H + ' </font> hour <font id= "f_mm" > ' + M + ' </font> Split <font id= "F_SS" > ' + S + ' </font> sec </span> ');
Start the countdown
var timeinterval = setinterval (function () {
If the time, minutes, and seconds are 0 o'clock, the current countdown will be stopped
if (h = = 0 && m = = 0 && s = = 0) {clearinterval (timeinterval);
When the seconds go to 0 o'clock, again for 60 seconds
if (s = = 0) {s = 60;}
if (s = = 60) {
Every time when the seconds go to 60 seconds, minutes minus one
M-= 1;
When the score equals 0 o'clock and the hour is 1 hours away, go inside and check it out.
if (m = = 0 && h > 0) {
Hour minus One
H-= 1;
Minutes automatically defaults to 60 points
m = 60;
seconds automatically defaults to 60 seconds
s = 60;
}
}
Seconds continue to beat, minus a
S-= 1;
Hour assignment
document.getElementById (' f_hh '). InnerHTML = h;
Minute assignment
document.getElementById (' f_mm '). InnerHTML = m;
Seconds Assignment
document.getElementById (' F_ss '). InnerHTML = S;
}, 1000);
</script>
</body>