<div class="cd">倒计时还剩 <em id="num" style="font-style:normal;color:red;"></em> 秒</div>
<script type="text/javascript">
var timestart = 100 ; //起始秒数
var ele = documentgetElementById("num");
setInterval(function(){
eleinnerHTML = timestart;
timestart--;
},1000);
</script>
十秒倒计时程序代码:
Dim N As Integer
Private Sub Form_Load()
N = 10
Timer1Interval = 1000
Timer1Enabled = True
End Sub
Private Sub Timer1_Timer()
N = N - 1
If N > 0 Then
Label1Caption = N
Else
Label1Caption = "时间到"
Timer1Enabled = False
End If
End Sub
<html>
<head>
<script language="javascript">
var a=new Array();
a[0]=24;
a[1]=0;
a[2]=0;
function jishi(){
if(a[2]>0){
a[2]--;
}else if(a[1]>0){
a[1]--;
a[2]=59;
}else if(a[0]>0){
a[0]--;
a[1]=59;
a[2]=59;
}else{
alert("时间到!");
}
var str1=a[0]+":";
var str2=a[1]+":";
var str3=a[2];
if(a[0]<10){
str1="0"+a[0]+":";
}else
if(a[1]<10){
str2="0"+a[1]+":";
}
if(a[2]<10){
str3="0"+a[2];
}
timeinnerHTML=str1+str2+str3;
}
function start(){
setInterval("jishi()",1000);
}
</script>
</head>
<body onload="start()">
<div><font color="#FF0000" size="7" ><span id="time">24:00:00</span></font></div>
</body>
</html>
欢迎分享,转载请注明来源:表白网
评论列表(0条)