当前位置:百问十四>生活百科>结婚倒计时代码

结婚倒计时代码

2024-06-20 17:37:25 编辑:join 浏览量:524

结婚倒计时代码

function aoyuntimelist() {

nowdate = new Date();

year = nowdate.getFullYear();

month = nowdate.getMonth()+1;

date = nowdate.getDate();

day = nowdate.getDay();

hour = nowdate.getHours();

minute = nowdate.getMinutes();

second = nowdate.getSeconds();

enddate = new Date(2010, 9, 1, 0, 0, 0);

shijiancha = (enddate.getTime()-nowdate.getTime())/1000;

if (shijiancha>=0) {

shengyutian = Math.floor(shijiancha/(3600*24));

shengyuxiaoshi = Math.floor((shijiancha-shengyutian*24*3600)/3600);

shengyufen = Math.floor((shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600)/60);

shengyumiao = Math.floor(shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600-shengyufen*60);

if (month<10) {

month = "0"+month;

}

if (date<10) {

date = "0"+date;

}

if (hour<10) {

hour = "0"+hour;

}

if (minute<10) {

minute = "0"+minute;

}

if (second<10) {

second = "0"+second;

}

if (shengyutian<10) {

shengyutian = "0"+shengyutian;

}

if (shengyuxiaoshi<10) {

shengyuxiaoshi = "0"+shengyuxiaoshi;

}

if (shengyufen<10) {

shengyufen = "0"+shengyufen;

}

if (shengyumiao<10) {

shengyumiao = "0"+shengyumiao;

}

txt1 = "2010年10月1日距我们结婚还有"+String(shengyutian)+"天"+String(shengyuxiaoshi)+"时"+String(shengyufen)+"分"+String(shengyumiao)+"秒";

txt2 = "今天是"+year+"年"+month+"月"+date+"日"+"星期"+day+"现在时刻"+hour+":"+minute+":"+second;

//txt1和txt2是两个动态文本框的变量名

} else {

if (month<10) {

month = "0"+month;

}

if (date<10) {

date = "0"+date;

}

if (hour<10) {

hour = "0"+hour;

}

if (minute<10) {

minute = "0"+minute;

}

if (second<10) {

second = "0"+second;

}

if (shengyutian<10) {

shengyutian = "0"+shengyutian;

}

if (shengyuxiaoshi<10) {

shengyuxiaoshi = "0"+shengyuxiaoshi;

}

if (shengyufen<10) {

shengyufen = "0"+shengyufen;

}

if (shengyumiao<10) {

shengyumiao = "0"+shengyumiao;

}

txt1 = "倒计时已经结束!祝我们新婚快乐!";

txt2 = "今天是"+year+"年"+month+"月"+date+"日"+"星期"+day+"现在时刻"+hour+":"+minute+":"+second;

}

}

setInterval(aoyuntimelist, 1000);

//以下是声音的链接和播放

mysound = new Sound();

mysound.attachSound(id="music");

mysound.start(0, 20);

标签:倒计时,代码,结婚

版权声明:文章由 百问十四 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.baiwen14.com/life/158387.html
热门文章