A very useful JS countdown! The webpage countdown in real time, accurate to second -level, the same as the countdown of the number of days. JS countdown is generally used for group purchase of mall website, special sale, many places can be used! Hope to help everyone!
The effect is as follows:
Copy code code as follows:
<! Doctype html>
<html>
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" /> />
<Style Type = "Text/CSS">
.leave_time_font {margin-heft: 35%;}
#Fo {margin-left: 32%;}
</style>
<Title> Woyaoni.cn- Countdown </Title>
</head>
<body>
<h1> woyaoni.cn </h1>
<script src = "./ jquery.js"> </script>
<script type = "text/javascript">
$ (docume) .Ready (function (e) {
var _Countseconds = 0;
function_countdown () {
_CountSeconds ++;
$ ('input.surplustime'). Each (function (index, element) {
var $ this = $ (this);
var _totalTime = Number ($ this.val ()) -_Countseconds;
var _Day = PARSEINT (_TotalTime/86400);
var _hours = PARSEINT (_TotalTime%86400/3600);
var _minutes = PARSEINT (_TotalTime%86400%3600/60);
var _Seconds = PARSEINT (_TotalTime%86400%3600%60);
var _Strlite = '<span>'+_ Day+'</span> Tian <span>'+_Hours+'</span> hours <span>'+_ minutes+'</span> > Second ';
var _Str = 'Countdown:'+_ Strlite;
if ($ this.next ('p.daojishi'). Length> 0) {
$ this.next ('P.Daojishi'). HTML (_Str);
} else if ($ this.next ('p.leave_time_font'). LENGTH> 0) {
$ this.next ('p.Leave_time_font'). html (_strlite);
}
});
}
SetInterval (_Countdown, 1000);
})
</script>
</head>
<body>
<? php
ini_Set ('date.timezone', 'asia/safehai');
$ Currenttime = Time ();
$ a = strtotime ('2014-2-14 00:00');
$ B = $ a-$ Currenttime;
?>>
<div ID = "djs">
<div ID = "Fo"> The little friends are left from Valentine's Day: </div>
<input type = "hidden" name = "Surplustime" value = "<? Php echo $ b;?>" />
<p> <span> 0 </span> Tian <span> 0 </span> hours <span> 0 </span> <span> 0 </span> second </p>
</div>
</body>
</html>