日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

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

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

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

無標題文檔

div{

display:inline;

}

var d = new Date();

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

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);

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

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

monthTime=(yearTime-b)*12;

//計算還有多少個月

//alert(monthTime);

c=Math.floor(monthTime);

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

//alert(c);

dayTime=(monthTime-c)*30;

//alert(dayTime);

//計算還有多少天

d=Math.floor(dayTime);

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

//alert(d);

hourTime=(dayTime-d)*24;

//alert(hourTime);

h=Math.floor(hourTime);

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

//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ù)2012年9月10日還有

總結(jié)

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

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