倒计时间代码
[ 2006-04-27 13:16:39 | 作者: kite ]
倒计时一
<%@ Language=VBScript %>
<%
response.write "今天是"
response.write formatDateTime(Date(),1) & ","
'格式化为长日期格式输出显示
response.write " 离高考还有"
response.write "<font color=blue><u>"
'调用DateDiff函数,计算日期间隔.
response.write DateDiff("d",Date(),"08-06-07")
response.write "</font></u>"
response.write "天"
%>
倒计时二
<!-- 倒记时 start -->
<table width=19% border=0 align="center" cellpadding=0 cellspacing=0 bgcolor=#F3F3F5 class=b1>
<tr>
<td height=23><img src=http://image2.sina.com.cn/ty/newf1/2006index/ty_f1_18.gif width=33 height=29></td>
<td class='ft02 f14' style='padding-top:4px;'><b>距土耳其站:</b></td>
</tr>
<tr>
<td height=1 colspan=2 bgcolor=#B8BAC9></td>
</tr>
<tr>
<td height=1 colspan=2 bgcolor=#FFFFFF></td>
</tr>
<tr>
<td height=48 colspan=2 align=center background=http://image2.sina.com.cn/ty/newf1/2006index/ty_f1_21.gif class='f14 p01'>
<font color=#CF2F0F><b>
<script>
document.write("<input id=timer style='cursor:default;border-width:0px; font-size:12px;width:90%;text-align:center;filter:alpha(opacity=70); font-weight:bold' ></input>")
function getTime() {
now = new Date();
y2k = new Date("August 27 2007 20:00:00");
if (now>=y2k){
document.getElementById("timer").innerText = "比赛正在进行中"
document.getElementById("timer").style.backgroundColor='white';
document.getElementById("timer").style.borderWidth='0px';
document.getElementById("timer").style.color='red';
}
else{
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
sec = (secondsRound == 1) ? "秒" : "秒 ";
min = (minutesRound == 1) ? "分" : "分 ";
hr = (hoursRound == 1) ? "时" : "时 ";
dy = (daysRound == 1) ? "天" : "天 ";
document.getElementById("timer").innerText = + daysRound + dy + hoursRound + hr + minutesRound + min + secondsRound + sec;
document.getElementById("timer").style.borderWidth='0px';
document.getElementById("timer").style.color='#EE3333';
newtime = window.setTimeout("getTime();", 1000);
}
}
getTime();
</script>
</b></font>
</td></tr>
</table>
<!-- 倒记时 end -->
永久地址: http://www.jmkite.com/kite/technology/feed.asp?q=comment&id=24
<%@ Language=VBScript %>
<%
response.write "今天是"
response.write formatDateTime(Date(),1) & ","
'格式化为长日期格式输出显示
response.write " 离高考还有"
response.write "<font color=blue><u>"
'调用DateDiff函数,计算日期间隔.
response.write DateDiff("d",Date(),"08-06-07")
response.write "</font></u>"
response.write "天"
%>
倒计时二
<!-- 倒记时 start -->
<table width=19% border=0 align="center" cellpadding=0 cellspacing=0 bgcolor=#F3F3F5 class=b1>
<tr>
<td height=23><img src=http://image2.sina.com.cn/ty/newf1/2006index/ty_f1_18.gif width=33 height=29></td>
<td class='ft02 f14' style='padding-top:4px;'><b>距土耳其站:</b></td>
</tr>
<tr>
<td height=1 colspan=2 bgcolor=#B8BAC9></td>
</tr>
<tr>
<td height=1 colspan=2 bgcolor=#FFFFFF></td>
</tr>
<tr>
<td height=48 colspan=2 align=center background=http://image2.sina.com.cn/ty/newf1/2006index/ty_f1_21.gif class='f14 p01'>
<font color=#CF2F0F><b>
<script>
document.write("<input id=timer style='cursor:default;border-width:0px; font-size:12px;width:90%;text-align:center;filter:alpha(opacity=70); font-weight:bold' ></input>")
function getTime() {
now = new Date();
y2k = new Date("August 27 2007 20:00:00");
if (now>=y2k){
document.getElementById("timer").innerText = "比赛正在进行中"
document.getElementById("timer").style.backgroundColor='white';
document.getElementById("timer").style.borderWidth='0px';
document.getElementById("timer").style.color='red';
}
else{
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
sec = (secondsRound == 1) ? "秒" : "秒 ";
min = (minutesRound == 1) ? "分" : "分 ";
hr = (hoursRound == 1) ? "时" : "时 ";
dy = (daysRound == 1) ? "天" : "天 ";
document.getElementById("timer").innerText = + daysRound + dy + hoursRound + hr + minutesRound + min + secondsRound + sec;
document.getElementById("timer").style.borderWidth='0px';
document.getElementById("timer").style.color='#EE3333';
newtime = window.setTimeout("getTime();", 1000);
}
}
getTime();
</script>
</b></font>
</td></tr>
</table>
<!-- 倒记时 end -->
[最后编辑于 kite, at 2006-08-25 06:53:21]
永久地址: http://www.jmkite.com/kite/technology/feed.asp?q=comment&id=24
此文还没有评论.
您无法为这篇日志发表评论.







心月湖
青草荷塘