北京2008奥运会倒计时程序

本站原创文章,转载请注明: 转载自zrong's Blog,原文 北京2008奥运会倒计时程序,欢迎使用文章源码进行转载。

本站转载文章会标明[转],转载请注明原始作者文章地址。



受好友冷雨之托制作一个倒计时程序,一时心血来潮干脆就做成了北京2008奥运倒计时了。

脚本很简单,就下面几句而已:

?View Code ACTIONSCRIPT
var beijing2008_date:Date = new Date(2008, 7, 8, 8);
refreshDate(beijing2008_date);
function refreshDate(old_date:Date):Void {
	var spareTime = Math.floor((old_date-(new Date()))/1000);
	var newDay = Math.floor(spareTime/3600/24);
	var newHour = Math.floor(spareTime/3600%24);
	var newMinute = Math.floor((spareTime%3600)/60);
	var newSecond = (spareTime%3600)%60;
	time = newDay+"天"+newHour+"小时"+newMinute+"分钟"+newSecond+"秒";
}
setInterval(refreshDate, 1000, beijing2008_date);

  北京2008奥运会倒计时源程序 (4.5 KiB, 201 hits)

发表评论?

4 条评论。

  1. 呵呵,不错。。真利害。我收藏了。

  2. 同学,错了,Date(2008, 8, 8, 20);

  3. jorende同学,请仔细看看ActionScript的Date类的帮助。

  4. 不错,收藏了

发表评论


请输入上面的验证码