时间倒计时例子
<Script Language="JavaScript">
/*
显示日期格式如:2004年05月28日 星期五
armyfeng
*/
now = new Date();
sMonth = "0" + (now.getMonth() + 1);
sDate = "0" + now.getDate();
sYear = now.getYear();
sDay = now.getDay();
sTime= now.getTime();
sMonth = sMonth.substr(sMonth.length - 2);
sDate = sDate.substr(sDate.length - 2);
sYear = (sYear < 2000) ? sYear + 1900 : sYear;
sWeek = "星期" + String("日一二三四五六").substr(sDay, 1);
document.write("当前时间:"+ sYear + "年" + sMonth + "月" + sDate + "日" + " " + sWeek + " ")
var timedate= new Date("Jan 25,2007");
var times="北京奥运会";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24));
if (time >= 0) ;
document.write("<font style='font-size:12px;line-height:18px;color:#000000'>离2008"+times+"开幕还有:</font><font style='color:#F5A100;line-height:32px;font-family:Verdana;font-size:24px;'><b>"+time +"</b></font><font style='font-size:12px;line-height:18px;color:#000000'>天</font>");
</Script>
<script language="JavaScript" type="text/javascript">
<!--
function show_date_time(){
var getdate
window.setTimeout("show_date_time()", 1000);
BirthDay=new Date("08-08-2008");//改成你的计时日期
today=new Date();
timeold=(BirthDay.getTime()-today.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
getdate=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;
document.write("目的时间:"+ getdate)
}
show_date_time();
//-->
</script>
<div id="span_dt_dt"></div>
/*
显示日期格式如:2004年05月28日 星期五
armyfeng
*/
now = new Date();
sMonth = "0" + (now.getMonth() + 1);
sDate = "0" + now.getDate();
sYear = now.getYear();
sDay = now.getDay();
sTime= now.getTime();
sMonth = sMonth.substr(sMonth.length - 2);
sDate = sDate.substr(sDate.length - 2);
sYear = (sYear < 2000) ? sYear + 1900 : sYear;
sWeek = "星期" + String("日一二三四五六").substr(sDay, 1);
document.write("当前时间:"+ sYear + "年" + sMonth + "月" + sDate + "日" + " " + sWeek + " ")
var timedate= new Date("Jan 25,2007");
var times="北京奥运会";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24));
if (time >= 0) ;
document.write("<font style='font-size:12px;line-height:18px;color:#000000'>离2008"+times+"开幕还有:</font><font style='color:#F5A100;line-height:32px;font-family:Verdana;font-size:24px;'><b>"+time +"</b></font><font style='font-size:12px;line-height:18px;color:#000000'>天</font>");
</Script>
<script language="JavaScript" type="text/javascript">
<!--
function show_date_time(){
var getdate
window.setTimeout("show_date_time()", 1000);
BirthDay=new Date("08-08-2008");//改成你的计时日期
today=new Date();
timeold=(BirthDay.getTime()-today.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
getdate=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;
document.write("目的时间:"+ getdate)
}
show_date_time();
//-->
</script>
<div id="span_dt_dt"></div>
浙公网安备 33010602011771号