您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" >
<title></title>
</head>
<body onload="leftTimer()">
<h3>投标倒记时:</h3>
<table>
<tr>
<td id="days" ></td>
<td id="hours"></td>
<td id="minutes"></td>
<td id="seconds"></td>
</tr>
</table>
<style type="text/css">
td{ background: #1e7bb3; padding: 0 10px; height: 50px; line-height: 50px; font-size: 30px; color: #fff; font-weight: bold;}
</style>
</body>
</html>
<script language="javascript" type="text/javascript">
var itimer=null;
function checkTime(i){ //将0-9的数字前面加上0,例1变为01
if(i <1)
{
return "00";
}
else
{
if(i<10)
{
i = "0" + i;
}
return i;
}
}
function c(a)
{
console.log(a);
}
function leftTimer(year,month,day,hour,minute,second){
var leftTime = (new Date(year,month-1,day,hour,minute,second)) - (new Date()); //计算剩余的毫秒数
var days = parseInt(leftTime / 1000 / 60 / 60 / 24 , 10); //计算剩余的天数
var hours = parseInt(leftTime / 1000 / 60 / 60 % 24 , 10); //计算剩余的小时
var minutes = parseInt(leftTime / 1000 / 60 % 60, 10);//计算剩余的分钟
var seconds = parseInt(leftTime / 1000 % 60, 10);//计算剩余的秒数
var seconds11=seconds;
days = checkTime(days);
hours = checkTime(hours);
minutes = checkTime(minutes);
seconds = checkTime(seconds);
document.getElementById("days").innerHTML = days+"天";
document.getElementById("hours").innerHTML = hours+"小时";
document.getElementById("minutes").innerHTML = minutes+"分";
document.getElementById("seconds").innerHTML = seconds+"秒";
//清除定时器任务
if(seconds11 < 0)
{
clearInterval(itimer);
}
c(leftTime);
}
window.onload = function(){
itimer= setInterval("leftTimer(2018,03,07,10,30,00)",1000);
}
</script>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。