日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

html距离已过去多久,用javascript写的倒计时,从某年某月距离到今天还有多少时间...

發(fā)布時(shí)間:2025/3/20 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html距离已过去多久,用javascript写的倒计时,从某年某月距离到今天还有多少时间... 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

從現(xiàn)在距離2012年9月10日教師節(jié)的倒計(jì)時(shí):

無標(biāo)題文檔

div{

display:inline;

}

var d = new Date();

//document.write(d.getTime()+"顯示據(jù)當(dāng)前的毫秒
"? );

var old = Date.parse("Sep? 10, 2012");

//document.write(old);

var a;

a=(Date.parse("Sep 10, 2012")-d.getTime());

//alert(a);

function? jishi(){

yearTime=a/1000/60/60/24/30/12;

//alert(yearTime);

//間隔的年數(shù)

b=Math.floor(a/1000/60/60/24/30/12);

//取得那個(gè)整的數(shù)值

//document.write(b+"年");

monthTime=(yearTime-b)*12;

//計(jì)算還有多少個(gè)月

//alert(monthTime);

c=Math.floor(monthTime);

//document.write(c+"月");

//alert(c);

dayTime=(monthTime-c)*30;

//alert(dayTime);

//計(jì)算還有多少天

d=Math.floor(dayTime);

//document.write(d+"日");

//alert(d);

hourTime=(dayTime-d)*24;

//alert(hourTime);

h=Math.floor(hourTime);

//document.write(h+"小時(shí)");

//alert(h);

minuteTime=(hourTime-h)*60;

//alert(minuteTime);

m=Math.floor(minuteTime);

//alert(m);

//document.write(m+"分鐘");

secondTime=(minuteTime-m)*60;

//alert(secondTime);

s=Math.floor(secondTime);

//document.write(s+"秒");

document.getElementById("monthdiv").innerHTML=c;

document.getElementById("daydiv").innerHTML=d;

document.getElementById("hourdiv").innerHTML=h;

document.getElementById("mdiv").innerHTML=m;

document.getElementById("sdiv").innerHTML=s;

setTimeout("jishi()",1000);

}

倒計(jì)時(shí):據(jù)2012年9月10日還有

總結(jié)

以上是生活随笔為你收集整理的html距离已过去多久,用javascript写的倒计时,从某年某月距离到今天还有多少时间...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。