您的位置首页健康问答

结婚倒计时代码

结婚倒计时代码

的有关信息介绍如下:

结婚倒计时代码

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