html5倒计时源码(html倒计时代码生成器)
本文目录一览:
html页面的倒计时代码。。。。急求!!!!
body
div id="timer"/div
script type="text/javascript" language="javascript"
var endDate=new Date(2010,11,11,17,05,40);//年月日时分秒,月要减去1
(function daoJiShi()
{
var now=new Date();
var oft=Math.round((endDate-now)/1000);
var ofd=parseInt(oft/3600/24);
var ofh=parseInt((oft%(3600*24))/3600);
var ofm=parseInt((oft%3600)/60);
var ofs=oft%60;
document.getElementById('timer').innerHTML='还有 '+ofd+' 天 ' +ofh+ ' 小时 ' +ofm+ ' 分钟 ' +ofs+ ' 秒';
if(ofs0){document.getElementById('timer').innerHTML='倒计时结束!';return;};
setTimeout('daoJiShi()',1000);
}());
/script
/body
倒计时html代码
倒计时的html代码:
!DOCTYPE HTML
html
head
meta charset="utf-8"
titleCSS3圆环倒计时-源码搜藏网/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, 100 100, 0, 100 100, 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, 100 100, 0, 100 100, 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:0px 0px 8px #333; background:-moz-radial-gradient(0% 50% 0deg, #900, #ff0000); background:-webkit-gradient(radial, 100 100, 0, 100 100, 110, from(#900), to(#ff0000)); }
.time { width:160px; height:160px; margin:20px 0 0 20px; background-color:#fff; border-radius:100px; position:absolute; z-index:1; box-shadow:0px 0px 8px #333 inset; text-align:center; line-height:160px; font-family:"Book Antiqua", Palatino, serif; font-size:35px; font-weight:bold; text-shadow: 1px 1px 3px #333; }
.time em { background:#fff; position:absolute; top:62px; left:12px; height:18px; width:140px; opacity:0.4; }
/style
/head
body
div class="3e13-bde8-1551-d571 hold hold1"
div class="bde8-1551-d571-025b pie pie1"/div
/div
div class="1551-d571-025b-a758 hold hold2"
div class="d571-025b-a758-7aae pie pie2"/div
/div
div class="025b-a758-7aae-e561 bg" /div
div class="a758-7aae-e561-a42b time"span/spanem/em/div
script src=""/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;
function showTime(){
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(totle0 MS0){
MS = MS - 1;
if(MS 10){MS = "0" + MS};
};
if(MS==0 SS0){
MS = 10;
SS = SS - 1;
if(SS 10){SS = "0" + SS};
};
if(SS==0 MM0){
SS = 60;
MM = MM - 1;
if(MM 10){MM = "0" + MM};
};
};
$(".time span").html(MM + ":" + SS + ":" + MS);
};
s = setInterval("showTime()",100);
function start1(){
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)");
};
function start2(){
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
input onclick="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倒计时代码
function countDown(time) {
var dates = new Date(time),
dates1 = (dates - new Date())/1000,
date = Math.floor(dates1/3600/24),
hour = Math.floor((dates1-date*24*3600)/3600),
minute = Math.floor((dates1-date*24*3600-hour*3600)/60),
second = Math.floor((dates1-date*24*3600-hour*3600-minute*60)),
con = document.getElementById('show');
con.innerHTML = '距离国庆节抢购时间还有:'+ date + '天' + hour + '时' + minute + '分' + second + '秒';
};
setInterval("countDown('2014/10/01')");
html页面的倒计时代码是什么?
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("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_student163_time();
//--
/SCRIPT
修改成需要的时间段,直接嵌入就可以了~~~祝你愉快!
html倒计时按钮代码
input type="button" value="倒计时"
onClick="timedMsg()"
p请阅读通告: sdfljslkfjlksdjglkjsgdkljgkdjgsdlk/p
p id="showtime"/p
script type="text/javascript"
var c=5;
var t;
function timedMsg()
{
document.getElementById('showtime').innerHTML=c;
if(c==0){
clearTimeout(t);
window.location.href="url";//为跳转地址
}else{
t=setTimeout('timedMsg()',1000);
}
c--;
}
/script
//这样即可 这是点击按钮开始倒计时,如果要是页面加载就开始的话,直接给body加onload事件即可