導航:首頁 > 源碼編譯 > 倒計時源碼

倒計時源碼

發布時間:2022-02-09 14:35:29

① html頁面的倒計時代碼。。。。急求!!!!

<br>倒計時已結束<br>
<span id="span_dt_dt" style='border:1px solid black;background-color:#FFFFFF' ></span>
<SCRIPT language=javascript>
<!--
//document.write("");
function show_time(){
window.setTimeout("show_time()", 1000);
BirthDay=new Date("00-00-0000");//改成你的計時日期
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_time();
//-->
</SCRIPT>
修改成需要的時間段,直接嵌入就可以。

② 倒計時代碼怎麼寫

#python 倒計時代碼
import time
count = 0
min = 10 #倒計時10個數
while (count < min):
time.sleep(1)#倒計時休眠時間1秒。
print("\r%s" % str(min - count).center(20,'-'), end="") # 總長度20,字元居中,其餘部分用'-'填空
count += 1

③ vb一小時倒計時源代碼,格式00:00:00

給一個自己寫的,篇幅更短,代碼更簡潔易懂的,允許自行指定24小時之內的倒計時。指定時,hh是小時數,賦值0-23,mm是分鍾數,賦值0-59,ss是秒數,賦值0-59,但mm和ss通常為0。點擊倒計時的按鈕即可開始。

'窗體內需要建立Command1控制項和Timer1控制項

Dim timeall As Long '計算倒計時的總秒數

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Sub Timer1_Timer()
If timeall = 0 Then
Command1.Caption = "00:00:00"
MsgBox "倒計時結束!"
Timer1.Enabled = False
Else
Command1.Caption = Format(timeall \ 3600, "00") & ":" & Format((timeall \ 60) Mod 60, "00") & ":" & Format(timeall Mod 60, "00")
timeall = timeall - 1
End If
End Sub

Private Sub Form_Activate()
Dim hh%, mm%, ss%
hh = 1: mm = 0: ss = 0 '指定倒計時的時間長度
Command1.Caption = Format(hh, "00") & ":" & Format(mm, "00") & ":" & Format(ss, "00")
timeall = hh * 3600& + mm * 60& + ss - 1
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub

④ 倒計時html代碼

倒計時的html代碼:

<!DOCTYPEHTML>
<html>
<head>
<metacharset="utf-8">
<title>CSS3圓環倒計時-源碼搜藏網</title>
<style>
.pie{width:200px;height:200px;background-color:blue;border-radius:100px;position:absolute;}
.pie1{clip:rect(0px,200px,200px,100px);-o-transform:rotate(0deg);-moz-transform:rotate(0deg);-webkit-transform:rotate(0deg);background:-moz-radial-gradient(20%50%0deg,#333,#0000ff);background:-webkit-gradient(radial,100100,0,100100,110,from(#000),to(#0000ff));}
.pie2{clip:rect(0px,100px,200px,0px);-o-transform:rotate(0deg);-moz-transform:rotate(0deg);-webkit-transform:rotate(0deg);background:-moz-radial-gradient(80%50%0deg,#333,#0000ff);background:-webkit-gradient(radial,100100,0,100100,110,from(#000),to(#0000ff));}
.hold{width:200px;height:200px;position:absolute;z-index:1;}
.hold1{clip:rect(0px,200px,200px,100px);}
.hold2{clip:rect(0px,100px,200px,0px);}
.bg{width:200px;height:200px;background-color:red;border-radius:100px;position:absolute;box-shadow:0px0px8px#333;background:-moz-radial-gradient(0%50%0deg,#900,#ff0000);background:-webkit-gradient(radial,100100,0,100100,110,from(#900),to(#ff0000));}
.time{width:160px;height:160px;margin:20px0020px;background-color:#fff;border-radius:100px;position:absolute;z-index:1;box-shadow:0px0px8px#333inset;text-align:center;line-height:160px;font-family:"BookAntiqua",Palatino,serif;font-size:35px;font-weight:bold;text-shadow:1px1px3px#333;}
.timeem{background:#fff;position:absolute;top:62px;left:12px;height:18px;width:140px;opacity:0.4;}
</style>
</head>
<body>
<divclass="holdhold1">
<divclass="piepie1"></div>
</div>
<divclass="holdhold2">
<divclass="piepie2"></div>
</div>
<divclass="bg"></div>
<divclass="time"><span></span><em></em></div>
<scriptsrc="http://www.codefans.net/ajaxjs/jquery-1.6.2.min.js"></script>
<script>
i=0;
j=0;
count=0;
MM=4;
SS=59;
MS=9;
totle=(MM+1)*600;
d=180*(MM+1);
MM="0"+MM;
functionshowTime(){
totle=totle-1;
if(totle==0){
clearInterval(s);
clearInterval(t1);
clearInterval(t2);
$(".pie2").css("-o-transform","rotate("+d+"deg)");
$(".pie2").css("-moz-transform","rotate("+d+"deg)");
$(".pie2").css("-webkit-transform","rotate("+d+"deg)");
}else{
if(totle>0&&MS>0){
MS=MS-1;
if(MS<10){MS="0"+MS};
};
if(MS==0&&SS>0){
MS=10;
SS=SS-1;
if(SS<10){SS="0"+SS};
};
if(SS==0&&MM>0){
SS=60;
MM=MM-1;
if(MM<10){MM="0"+MM};
};
};
$(".timespan").html(MM+":"+SS+":"+MS);
};
s=setInterval("showTime()",100);
functionstart1(){
i=i+0.6;
count=count+1;
if(count==300){
count=0;
clearInterval(t1);
t2=setInterval("start2()",100);
};
$(".pie1").css("-o-transform","rotate("+i+"deg)");
$(".pie1").css("-moz-transform","rotate("+i+"deg)");
$(".pie1").css("-webkit-transform","rotate("+i+"deg)");
};
functionstart2(){
j=j+0.6;
count=count+1;
if(count==300){
count=0;
clearInterval(t2);
t1=setInterval("start1()",100);
};
$(".pie2").css("-o-transform","rotate("+j+"deg)");
$(".pie2").css("-moz-transform","rotate("+j+"deg)");
$(".pie2").css("-webkit-transform","rotate("+j+"deg)");
};
t1=setInterval("start1()",100);
</script>
<inputonclick="window.open('view-source:'+window.location.href)"type="button"value="查看源代碼"style="position:absolute;right:0;top:0;width:80px;height:30px;">
</body>
</html>

直接復制代碼,創建html文件,然後復制進去,就可以看到效果了。

⑤ 求個html倒計時代碼

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id="box">
還剩:
<label for="" id="hour">00</label>小時
<label for="" id="minute">00</label>分
<label for="" id="second">00</label>秒
</div>
<script type="text/javascript">
var o_b=document.getElementById("box");
//獲取界面標簽對象
var o_h=document.getElementById("hour");
var o_m=document.getElementById("minute");
var o_s=document.getElementById("second");
function showTime(){
var nowDate=new Date();
//把結束時間轉化為日期對象
console.log(nowDate)
var nowTime=nowDate.getTime();
var endDate=new Date("2019/01/20 00:00:00");
var endTime=endDate.getTime();
//距離結束時間剩餘的秒數
var diffTime=parseInt((endTime-nowTime)/1000);
console.log(diffTime)
if(diffTime<=0){
o_b.innerHTML="秒殺結束";
clearInterval(t);//清除定時器
}
//將剩餘時間(秒)轉換為時、分、秒
var hour=parseInt(diffTime/60/60);
var minute=parseInt(diffTime/60%60);
var second=diffTime%60;
if(hour<10){
hour="0"+hour;
}
if(minute<10){
minute="0"+minute;
}
if(second<10){
second="0"+second;
}
console.log(o_h);
console.log(o_m);
console.log(o_s);
o_h.innerHTML=hour;
o_m.innerHTML=minute;
o_s.innerHTML=second;
// setTimeout(showTime,1000);
}
showTime();
var t=setInterval(showTime,1000);
console.log(t);
</script>
</body>
</html>

⑥ 倒計時器代碼

程序設計思想:
(1)輸入目標時間,高考的年,月,日,時,分,秒
下面例子中簡寫成直接賦值。
(2)轉換成 struct tm
(3)再轉換成 time_t
(4) 獲當前時間 now = time (NULL);
(5)用difftime 計算時間差,送返 long double 秒
(6)把秒轉換成 日,時,分,秒
(7)循環 (下面例子中簡寫成 列印120次,每隔2秒左右打一次)

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}

void main(){
time_t rawtime;
struct tm * target_time;
int d,h,m,s;
int k=0;
long double dif,r;
time_t now,t_end; // in sec

/* get current timeinfo and modify it to the user's choice */
time ( &rawtime );
target_time = localtime ( &rawtime );

// time struc and to time_t
target_time->tm_year = 2008 - 1900; //year - 1900
target_time->tm_mon= 7 - 1; // month - 1
target_time->tm_mday = 15 ; // day
target_time->tm_hour = 13 ; // hour
target_time->tm_min = 1 ;
target_time->tm_sec = 1 ;
t_end = mktime (target_time);
// printf("%s ",ctime(&t_end)); //print and check

while (k < 120)
{
now = time (NULL);
// printf("%s ",ctime(&now)); // print and check
dif = difftime (t_end,now); //double , time_t time_t
// printf( "%lf\n",dif);
d = (int) (dif / 86400.0);
r = dif - d * 86400.0;
h = (int) (r / 3600.0);
r = r - h * 3600.0;
m = (int) (r / 60.0);
r = r - m * 60.0;
s = (int) (r);
printf("%d--days %d--hours %d--min %d--sec\n",d,h,m,s);
(void) wait ( 2 ); // every 2 seconds print
k = k + 1;

};
}

⑦ 網頁倒計時代碼

完整的程序代碼如下:

<span id=tt></span>秒以後返回<a href=index.html>首頁</a>

<script type=text/javascript>
var t=5;
function w(){
tt.innerHTML=t;
t--;
if (t==0) location.href='index.html';
setTimeout("w();",1000);
}
w();
</script>

以上代碼測試通過,使用方法是保存為HTML文件,使用瀏覽器打開。

⑧ 時間倒計時代碼

這是用VB寫的,需在窗體上放一個label控制項,如果你要用到自己程序里,裡面還需加一些大小判斷,請自己完善:
Private Sub Timer1_Timer()
Dim aa As Date
Dim bb As Date
aa = Now '一般用當前時間就可以了
bb = CDate("2006-11-30 11:38:33") '將來的時間
Label1.Caption = Year(bb) - Year(aa) & "年" & Month(bb) - Month(aa) & "月" & Day(bb) - Day(aa) & "天" & Hour(bb) - Hour(aa) & "小時" & Minute(bb) - Minute(aa) & "分鍾" & Second(bb) - Second(aa) & "秒鍾"
End Sub

⑨ 求一個24小時的倒計時html代碼

這個不是HTML代碼能實現的,一般網頁使用JS腳本!比如:<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 24*60*60
function CountDown(){
if(maxtime>=0){
hour = Math.floor(maxtime/3600);
minutes = Math.floor(maxtime/1440);
seconds = Math.floor(maxtime%60);
msg = "距離結束還有"+hour+"時"+minutes+"分"+seconds+"秒";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*60) alert('注意,還有5分鍾!');
--maxtime;
}
else{
clearInterval(timer);
alert("時間到,結束!");
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="color:red" mce_style="color:red"></div>

⑩ 求:一款倒計時代碼

<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(){
window.setTimeout("show_student163_time()", 1000);
BirthDay=new Date("04-01-2005");//改成你的計時日期
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>

閱讀全文

與倒計時源碼相關的資料

熱點內容
播放解壓的圖 瀏覽:228
新建一個名為hux的文件夾 瀏覽:532
橋水基金加密貨幣 瀏覽:196
還有什麼好app 瀏覽:152
微軟最慘的源碼 瀏覽:40
上海靈意壓縮機 瀏覽:415
泰拉瑞亞2020最新伺服器ip地址 瀏覽:563
安卓機玩吃雞什麼畫質 瀏覽:873
徒步緩解壓力的視頻 瀏覽:238
圖像演算法口訣 瀏覽:859
人踩什麼解壓 瀏覽:921
php語法檢查命令 瀏覽:330
如何重設伺服器網關 瀏覽:865
世界經濟pdf 瀏覽:108
異或演算法找缺失的數 瀏覽:326
單片機flagt1 瀏覽:486
單片機清理 瀏覽:660
東風景逸空調壓縮機 瀏覽:158
天津程序員炒股 瀏覽:230
pcl源碼目錄 瀏覽:968