倒计时也用过几次了,但这个向上,向下取值的原理是怎样的还不是很清楚,为什么用向下呢?之前也问过朋友,可是说得也不是很清楚
function timer(){
var fut = new Date(2017,1,1,10,10,36);
var now = new Date();
// alert(now.getTime());
var ti = new Date(2017,1,1,10,10,36)-new Date();
var tian = Math.floor(ti / ( 1000*60*60*24 ));
var shi = Math.floor(ti / (1000*60*60)%24);
var fen = Math.floor(ti / (1000*60)%60);
var miao = Math.floor(ti /1000%60);
document.getElementById("tian").innerHTML=tian;
document.getElementById("shi").innerHTML=shi;
document.getElementById("fen").innerHTML=fen;
document.getElementById("miao").innerHTML=miao;
}
Caballarii
MarlboroKay
相关分类