帮我编段网页倒计时代码

作者&投稿:易牲 (若有异议请与网页底部的电邮联系)
html页面的倒计时代码。。。。急求!!!!~




var endDate=new Date(2010,11,11,17,05,40);//年月日时分秒,月要减去1
(function daoJiShi()
{
var now=new Date();
var oft=Math.round((endDate-now)/1000);
var ofd=parseInt(oft/3600/24);
var ofh=parseInt((oft%(3600*24))/3600);
var ofm=parseInt((oft%3600)/60);
var ofs=oft%60;
document.getElementById('timer').innerHTML='还有 '+ofd+' 天 ' +ofh+ ' 小时 ' +ofm+ ' 分钟 ' +ofs+ ' 秒';
if(ofs<0){document.getElementById('timer').innerHTML='倒计时结束!';return;};
setTimeout('daoJiShi()',1000);
}());










var time=new Date();
time.setHours(1);
time.setMinutes(30);
time.setSeconds(0);
var timeout;
var timeshow=document.getElementById("timeshow");
function countdown(){
var hour=time.getHours();
var min=time.getMinutes();
var second=time.getSeconds();
if(hour=="0"&&min=="0"&&second=="0"){alert("Time Out!");clearInterval(timeout);}
time.setSeconds(second-1);
hour<10?hour="0"+hour:hour;
min<10?min="0"+min:min;
second<10?second="0"+second:second;
timeshow.innerHTML=hour+":"+min+":"+second;
}
timeout= setInterval(countdown,1000);




初学菜鸟 编的不好请指教

4月1日也是我的生日...
看我这个,直接运行
<br>距离2007年4月1日还有
<span id="span_dt_dt" style='border:1px solid black;background-color:#FFFFFF' ></span>
<SCRIPT language=javascript>
<!--
//document.write("");

function show_student163_time(){
window.setTimeout("show_student163_time()", 1000);
BirthDay=new Date("04-01-2007");//改成你的计时日期
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);
span_dt_dt.innerHTML=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;

}
show_student163_time();
//-->
</SCRIPT>

<html>
<head>
<title>倒计时</title>
<style>
.time{color:#ffffff;font-family:verdana,geneva,helveticafont-size:9pt}
a:link{text-decoration:none;color:#000000}
a:active{text-decoration:none;color:#000000}
a:visited{text-decoration:none;color:#000000}
a:hover{text-decoration:none;color:#000000}
</style>

<script language="javascript">

var time_now_server,time_now_client,time_end,time_server_client,timerID;

time_end=new Date("Jan 20, 2002 00:00:00");
time_end=time_end.getTime();

time_now_server=new Date("Dec 21, 2001 13:11:1");
time_now_server=time_now_server.getTime();

time_now_client=new Date();
time_now_client=time_now_client.getTime();

time_server_client=time_now_server-time_now_client;

setTimeout("show_time()",1000);

function show_time()
{
timer.innerHTML =time_server_client;

var time_now,time_distance,str_time;
var int_day,int_hour,int_minute,int_second;
var time_now=new Date();
time_now=time_now.getTime()+time_server_client;
time_distance=time_end-time_now;
if(time_distance>0)
{
int_day=Math.floor(time_distance/86400000)
time_distance-=int_day*86400000;
int_hour=Math.floor(time_distance/3600000)
time_distance-=int_hour*3600000;
int_minute=Math.floor(time_distance/60000)
time_distance-=int_minute*60000;
int_second=Math.floor(time_distance/1000)

if(int_hour<10)
int_hour="0"+int_hour;
if(int_minute<10)
int_minute="0"+int_minute;
if(int_second<10)
int_second="0"+int_second;
str_time="<font style='font-size:14pt;color:#28C84A'>"+int_day+"</font><font face='黑体' style='font-size:13pt;'>天</font><br>"+int_hour+":"+int_minute+":"+int_second;
timer.innerHTML=str_time;
setTimeout("show_time()",1000);
}
else
{
timer.innerHTML ="over";
clearTimeout(timerID)
}
}
</script>
<style>
.time{color:#000000;font-family:verdana;font-size:9pt}
</style>
</head>

<BODY BGCOLOR=#FFFFFF topmargin=2 leftmargin=2>
<div id="Layer1" style="position:absolute; width:160px; height:187px; z-index:1">
<!-- begin calendar -->
<table width=160 border=0 cellpadding=0 cellspacing=0>
<tr>
<td colspan=3> </td>
</tr>
<tr>
<td width="47"> </td>
<td background="images/mail_03.gif" width="67" valign="top">
<table width=65 cellpadding=3 cellspacing=0 border=0>
<tr>
<td align=center class="time">
<a href="http://203.212.7.76:8000/Announcement.html" target=_blank><div id="timer" style="font-size:9pt;color:red"></div></a>
</td>
</tr>
</table>
</td>
<td width="46"> </td>
</tr>
<tr>
<td colspan=3> </td>
</tr>
</table>
<!-- end calendar -->
</div>
</BODY>
</HTML>

<HTML><HEAD><TITLE>倒计时</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY bgColor="#3399FF" >
<P align=center> </P>
<P align=center> </P>
<P align=center> </P>
<P align=center> </P>
<P align=center><FONT
style="FONT-SIZE: 30pt; FILTER: shadow(color=#999999,strength=4); WIDTH: 100%; COLOR: #ff6600; LINE-HEIGHT: 150%; FONT-FAMILY: 黑体">
       闲云野鹤提醒**倒计时:           
  <BR>              
坚持就胜利!!             
<BR>
<SPAN id=span_dt_dt></SPAN>
<SCRIPT language=javascript>
<!--
//document.write("");

function show_date_time(){
window.setTimeout("show_date_time()", 1000);
BirthDay=new Date("4-01-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);
span_dt_dt.innerHTML="还有"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒"+"!" ;

}

show_date_time();

//-->
</SCRIPT>
</FONT></TD></P>
</BODY></HTML>
可以将此段代码复制到记事本里,然后保存时加上后缀.htm就可以看到效果了!试试,如果行的话就追加两分!


html页面的倒计时代码。。。急求!!!
4、窗口化游戏模式下,切换游戏画面和计时网页 较为方便。请用 atl+tab键或win键 尝试切换 5、游戏每局第一回合倒计时2分30秒时,开始计时。 源代码如下: 网页版倒计时 var t function timedCount(StartScriptTime) {var EndScriptTime=Date.parse(new Date())\/1000 var ttime=EndScriptTime-StartScriptTime...

html页面的倒计时代码。。。急求!!!
1、将源代码直接另存为html 2、只能用IE浏览器打开。如果默认浏览器不是IE。可以右键点击Html文件,选择用IE打开 3、如果提示是否同意运行activex插件。请选择允许阻止的内容即可。4、窗口化游戏模式下,切换游戏画面和计时网页?较为方便。请用?atl+tab键或win键?尝试切换 5、游戏每局第一回合倒计时2...

网页倒计时代码,精确到秒
第一步:把如下代码加入区域中 <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function getTime() { now = new Date();y2k = new Date("Jan 1 2005 14:00:00");days = (y2k - now) \/ 1000 \/ 60 \/ 60 \/ 24;daysRound = Math.floor(days);hours = (y2k - now) \/ 1000 \/ 60 \/...

网页倒计时代码
msg = "距离结束还有"+minutes+"分"+seconds+"秒";<SCRIPT LANGUAGE="JavaScript"> <!-- var maxtime;if(window.name==''){ maxtime = 60*60;}else{ maxtime = window.name;} function CountDown(){ if(maxtime>=0){ minutes = Math.floor(maxtime\/60);seconds = Math.floor(maxtim...

网页倒计时代码
完整的程序代码如下:秒以后返回首页 var t=5;function w(){ tt.innerHTML=t;t--;if (t==0) location.href='index.html';setTimeout("w();",1000);} w(); 以上代码测试通过,使用方法是保存为HTML文件,使用浏览器打开。

高分跪求求一个循环倒计时的JS代码,网页上用的。
var daytemp=3\/\/新增加变量 function show_date_time(){ window.setTimeout("show_date_time()", 1000);BirthDay=new Date("02\/26\/2012");\/\/改成你的计时日期 today=new Date();timeold=(BirthDay.getTime()-today.getTime());sectimeold=timeold\/1000 secondsold=Math.floor(sectimeo...

ASP网页上的倒计时代码,要求可以防刷新的
document.getElementById(time_id[i]).innerHTML = "逾期,倒计时已经失效";} else { \/\/天数取三位,不足时前边补0 if (daysold < 10) { daysold = daysold } \/\/天数取三位,不足时前边补0 if (daysold < 100) { daysold = daysold } \/\/小时取两位,不足补0 if (hrsold < ...

时间倒计时代码
倒计时 var now = new Date("11\/26\/2006 " + 10 + ":" + 30 + ":" + 30);function GetServerTime(){ var urodz = new Date("11\/30\/2006 11:38:33");now.setTime(now.getTime()+250);days = (urodz - now) \/ 1000 \/ 60 \/ 60 \/ 24;daysRound = Math...

飘浮倒计时网页代码
js代码:fun.js var timmerID = null;function time() { var time = document.getElementById("now");var left = document.getElementById("left");var t = time.value.split(":");var hour = parseInt(t[0]);var min = parseInt(t[1]);min=min+1;if(min==60){ hour=hour+1;mi...

网页嵌入倒计时器代码
var now = new Date();var ile = urodz.getTime() - now.getTime();var dni = Math.floor(ile \/ (1000 * 60 * 60 * 24));if (dni > 1)document.write("今天离"+s+"还有"+dni +"天")else if (dni == 1)document.write("只有2天啦!")else if (dni == 0)document....

岳普湖县15237827365: 哪位高手提供一些网页倒计时的代码呀!!谢谢啦
局哀金纳:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script type="text/javascript"> <!-- var duration=9900; var endTime = new Date().getTime() + duration + 100...

岳普湖县15237827365: 在html页面加一个倒计时90分钟代码怎么写 -
局哀金纳: <html><head></head><body><div id="timeshow"></div><script type="text/javascript">var time=new Date();time.setHours(1);time.setMinutes(30);time.setSeconds(0);var timeout;var timeshow=document.getElementById("timeshow");function...

岳普湖县15237827365: 谁可以帮我做个网页代码,倒计时的
局哀金纳: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> New Document </TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT=""><META NAME=...

岳普湖县15237827365: html页面的倒计时代码....急求!!!! -
局哀金纳: AVA使用步骤: 1、将源代码直接另存为html 2、只能用IE浏览器打开.如果默认浏览器不是IE.可以右键点击Html文件,选择用IE打开 3、如果提示是否同意运行activex插件.请选择允许阻止的内容即可. 4、窗口化游戏模式下,切换游戏画面...

岳普湖县15237827365: 求个网页倒计时代码
局哀金纳: 有分秒显示 里面的时间自己设置 <br>距离考试还有<br> <span id="span_dt_dt" style='border:1px solid black;background-color:#FFFFFF' ></span> <SCRIPT language=javascript> <!-- //document.write(""); function show_student163_time()...

岳普湖县15237827365: 我想弄一个网页时间倒计时从4天17个小时30分开始谁会代码麻烦给我个 -
局哀金纳: aa之间-->function setcountdown(theyear,themonth,theday){ yr=theyear;mo=themonth;da=theday } setcountdown(终止的时间 XXXX/XX/XX) var occasion="距离XX还有" var message_on_occasion="XXXXXXXXXXXX!" var ...

岳普湖县15237827365: 求能实现网页倒计时功能的代码 -
局哀金纳: 有分秒显示 里面的时间自己设置 距离考试还有

岳普湖县15237827365: 求一段好看的网页倒计时的代码
局哀金纳: 你觉得,定时刷新可以吗,就是在多少秒以后页面自动跳转到你想要的页面

岳普湖县15237827365: 网页倒计时代码
局哀金纳: <script language="JavaScript">var urodz= new Date("8/8/2008");var s="今天距离2008奥运会开幕还有";var now = new Date();var ile = urodz.getTime() - now.getTime();var dni = Math.floor(ile / (1000 * 60 * 60 * 24));if (dni > 1)document.write(...

岳普湖县15237827365: 网页倒计时代码 -
局哀金纳: 恭喜您登陆成功!秒以后将返回首页,如果5秒以后页面没有跳转,请点击这里

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网