如何制作倒计时时钟(页面上)

mascotzhuang 2004-08-03 01:46:24
如题,是在页面上显示,而不是在Statusbar上显示。谢谢。
...全文
348 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
andraw2002 2004-08-03
  • 打赏
  • 举报
回复


<script language="JavaScript" type="text/javascript">
<!--//
var hour,minute,second,totalSecond,actTime;
var isBegin;

totalSecond = 0;
hour = 0; minute = 0; second = 15; //设置作题时间
totalSecond = (hour * 60 * 60) + (minute * 60) + second;
isBegin = true;

function clock(intSign){
if(intSign==1){ //开始答题时
for(var i=0;i<document.St.length;i++){
var temp = document.St[i].name.substring(0, 3);
if(temp=="zd_"){
document.St[i].disabled = false;
}
}
}
var conHourToSecond,conMinuteToSecond;
conHourToSecond = 60 * 60; conMinuteToSecond = 60; //设置常量
if(totalSecond-- > 1){
var strHour,strMinute,strSecond;
strHour = Math.floor(totalSecond/conHourToSecond);
strMinute = Math.floor((totalSecond - strHour*conHourToSecond)/conMinuteToSecond);
strSecond = totalSecond - strHour*conHourToSecond - strMinute*conMinuteToSecond;
document.all.Clock.value = strHour + ":" + strMinute + ":" + strSecond;
actTime = window.setTimeout("clock(0)", 1000);
}else{
document.all.Clock.value = "0:0:0";
TimeOut();
alert("答题时间到!停止作答!");
window.clearTimeout(actTime);
}
}

function initClock(obj){ //初始时,不能作答,只有点击开始后才能作答
for(var i=0;i<document.St.length;i++){
var temp = document.St[i].name.substring(0, 3);
if(temp=="zd_"){
document.St[i].disabled = true;
}
}
obj.value = hour + ':' + minute + ':' + second;
}

function TimeOut(){ //答题时间到
for(var i=0;i<document.St.length;i++){
var temp = document.St[i].name.substring(0, 3);
if(temp=="zd_"){
document.St[i].disabled = true;
}
}
}
//-->
</script>
787912 2004-08-03
  • 打赏
  • 举报
回复
<script language=vbscript>
window.setInterval "showtime",1000
sub showtime
dim d1,d2
d1=cdate("2005-1-1 0:0:0")
d2=now
window.divtime.innerHTML="现在距离2005年1月1日0时0分0秒还有 <font color=red><b>" & clng((cdbl(d1)-cdbl(d2))*24*60*60) & "</b></font>秒"
end sub
</script>
tianjy 2004-08-03
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta name="vs_defaultClientScript" content="VBScript">
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<div id=divtime></div>
<script language=vbscript>
window.setInterval "showtime",1000
sub showtime
dim d1,d2
d1=cdate("2005-1-1 0:0:0")
d2=now
window.divtime.innerHTML="现在距离2005年1月1日0时0分0秒还有 <font color=red><b>" & clng((cdbl(d1)-cdbl(d2))*24*60*60) & "</b></font>秒"
end sub
</script>

</body>
</html>
smallyear 2004-08-03
  • 打赏
  • 举报
回复
不知道有什么分別﹐只是賦值對象不同而已
wsdzmhongm 2004-08-03
  • 打赏
  • 举报
回复
<span>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧