求html网页高手 倒计时代码!

<TBODY>
<TR>
<TD vAlign=top width=200>

<TBODY>
<TR>
<TD>
<TABLE width=234 height="60"
border=0 align=center cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD colSpan=2 height=24><div align="center" class="STYLE3">距08年8月8日 奥运会开幕还有</div></TD></TR>
<TR>
<TD width="87" align=middle class=fb id=timeDate><div align="center" class="STYLE3">660天</div></TD>
<TD width="147"
align=middle class=fb id=times><div align="center" class="STYLE3">18:09:53</div></TD>
</TR></TBODY></TABLE>
<SCRIPT>
var now = new Date();
function createtime(){

var grt= new Date("8/08/2008 20:00:00");

now.setTime(now.getTime()+250);
days = (grt - now) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
hours = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;}
minutes = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes);
if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds);
if(String(snum).length ==1 ){snum = "0" + snum;}

document.getElementById("timeDate").innerHTML = dnum+"天";
document.getElementById("times").innerHTML = hnum + ":" + mnum + ":" + snum;
}

setInterval("createtime()",250);
</SCRIPT>
</TD></TR></TBODY></TABLE>

=======================
如上,本人笨,想加入一个框。。。。。。。有分送!
而且很奇怪,网页上只能显示一个。举例是我两个模块,放同样的代码进去只有一个显示!求指教呀高手们!
整体加个框。很简单的框就行了!

不知道对不对啊 你看看啊
<HTML>
<HEAD>
<TITLE>时间日期篇--倒计时1</TITLE>
</HEAD>

<BODY bgcolor="#fef4d2" onLoad=DownCount()>

<br><br>
<center>
<font color="ffaafa"><h2>时间日期篇--倒计时1</h2></font>
<hr width=300>
<br><br>

<!-- 案例代码1开始 -->

<script language=JavaScript>

<!-- [Step1]: 这里可以设置倒计时的月日年 -->
var theDay = new Date("January 1, 2008")
var DayALL

function DownCount(){
var today = new Date()
var seconds = Math.floor((theDay.getTime() - today.getTime())/1000)
var minutes = Math.floor(seconds/60)
var hours = Math.floor(minutes/60)
var days = Math.floor(hours/24)
CDay= days
CHour= hours % 24
CMinute= minutes % 60
CSecond= seconds % 60
DayALL = CDay + " 天 , " + CHour + " 小时 , " + CMinute + " 分钟 , " + CSecond + " 秒 "
document.clock.DownCount.value = DayALL
var counter = setTimeout("DownCount()", 1000)
}

</script>

<!-- 案例代码1结束 -->

<!-- 案例代码2开始 -->

<form name = "clock">
<!-- [Step2]: 这里可以更该页面上显示的提示信息 -->
距离 2008 年 1 月 1 日,您将还有 <br>
<!-- [Step3]: 这里可以改变时间的列长度 -->
<input type="TEXT" name= "DownCount" size= "35">
</form>

<!-- 案例代码2结束 -->

</BODY>

</HTML>追问

哥们。。。我不是要这个效果,我要上面的离XXX都框起来。

追答

把要显示的都框在一起啊

追问

嗯。对。说白了就是一个框,然后里面是代码运行的内容。不胜感激!

追答

你看看啊

时间日期篇--倒计时1

时间日期篇--倒计时1

var theDay = new Date("January 1, 2008")
var DayALL

function DownCount(){
var today = new Date()
var seconds = Math.floor((theDay.getTime() - today.getTime())/1000)
var minutes = Math.floor(seconds/60)
var hours = Math.floor(minutes/60)
var days = Math.floor(hours/24)
CDay= days
CHour= hours % 24
CMinute= minutes % 60
CSecond= seconds % 60
DayALL = "距离 2008 年 1 月 1 日,您将还有 "+ CDay + " 天 , " + CHour + " 小时 , " + CMinute + " 分钟 , " + CSecond + " 秒 "
document.clock.DownCount.value = DayALL
var counter = setTimeout("DownCount()", 1000)
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2016-09-22
<TBODY>
<TR>
<TD vAlign=top width=200>

<TBODY>
<TR>
<TD>
<p> </p>
<p>示例1:ID分别为timeDate,times</p>
<TABLE width=617 height="24"
border=0 align=center cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD height=24 align="center" class="STYLE3">距08年8月8日 奥运会开幕还有<span id="timeDate">660天</span><span id="times">18:09:53</span></TD>
</TR></TBODY></TABLE>
<p>
</p>
<p> </p>
<p> </p>
<p> </p>
<p>示例2:ID分别为timeDate2,times2</p>
<TABLE width=617 height="24"
border=0 align=center cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD height=24 align="center" class="STYLE3">距08年8月8日 奥运会开幕还有<span id="timeDate2">660天</span><span id="times2">18:09:53</span></TD>
</TR></TBODY></TABLE>

<SCRIPT>
var now = new Date();
function createtime(timeDate,times)
{

var grt= new Date("8/08/2008 20:00:00");

now.setTime(now.getTime()+250);
days = (grt - now) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
hours = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;}
minutes = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes);
if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds);
if(String(snum).length ==1 ){snum = "0" + snum;}

document.getElementById(timeDate).innerHTML = dnum+"天";
document.getElementById(times).innerHTML = hnum + ":" + mnum + ":" + snum;
}

//执行示例1
setInterval("createtime('timeDate','times')",250);

//执行示例2
setInterval("createtime('timeDate2','times2')",250);
</SCRIPT>追问

哥们,你的框呢。。。

追答



示例1

距08年8月8日 奥运会开幕还有660天 18:09:53

示例2

距08年8月8日 奥运会开幕还有660天 18:09:53

var now = new Date();
function createtime(timeDate,times)
{

var grt= new Date("8/08/2008 20:00:00");

now.setTime(now.getTime()+250);
days = (grt - now) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
hours = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;}
minutes = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes);
if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds);
if(String(snum).length ==1 ){snum = "0" + snum;}

document.getElementById(timeDate).innerHTML = dnum+"天";
document.getElementById(times).innerHTML = hnum + ":" + mnum + ":" + snum;

//setTimeout("createtime("+timeDate+","+times+")",250);
}

//执行示例1
setInterval("createtime('timeDate','times')",250);

//执行示例2
setInterval("createtime('timeDate2','times2')",250);

追问

字能框起来么?

追答

自不是已经框起来了吗?你还要怎么框起来?

追问

我的想法是所有的都框起来。。。。包括距“奥运会开始”

追答



示例1

距08年8月8日 奥运会开幕还有660天 18:09:53

示例2

距08年8月8日 奥运会开幕还有660天 18:09:53

var now = new Date();
function createtime(timeDate,times)
{
var grt= new Date("8/08/2008 20:00:00");
now.setTime(now.getTime()+250);
days = (grt - now) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
hours = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;}
minutes = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes);
if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds);
if(String(snum).length ==1 ){snum = "0" + snum;}

document.getElementById(timeDate).innerHTML = dnum+"天";
document.getElementById(times).innerHTML = hnum + ":" + mnum + ":" + snum;
}
setInterval("createtime('timeDate','times')",250);
setInterval("createtime('timeDate2','times2')",250);

本回答被提问者采纳
第2个回答  2011-10-30
好心人尽在百度知道!
相似回答