您好,登錄后才能下訂單哦!
<span class="cd_item_txt" id="days">00</span></div>
<div class="cd_item cd_hour" ><span class="cd_item_txt" id="hours">00</span></div>
<div class="cd_item cd_minute"><span class="cd_item_txt" id="minutes">00</span></div>
<div class="cd_item cd_second"><span class="cd_item_txt" id="seconds">00</span></div></div>
<script type="text/javascript" src="js/jquery-1.9.1.min.js">
<!-- 秒殺時間js start-->
<div>
function leftTimer(year,month,day,hour,minute,second){
var leftTime = (new Date(year,month-1,day,hour,minute,second)) - (new Date()); //計算剩余的毫秒數
// alert(leftTime);
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);//計算剩余的秒數
days = checkTime(days);
hours = checkTime(hours);
minutes = checkTime(minutes);
seconds = checkTime(seconds);
document.getElementById("days").innerHTML = days;
document.getElementById("seconds").innerHTML = seconds;
document.getElementById("minutes").innerHTML = minutes;
document.getElementById("hours").innerHTML = hours;
}
function checkTime(i){ //將0-9的數字前面加上0,例1變為01
if(i<10)
{
i = "0" + i;
}
return i;
}
//$seckill_time = ‘2018,04,04,10,00,00';
setInterval("leftTimer({$seckill_time})",1000); //在這里修改6個參數 ,根據后臺傳值
leftTimer();
</div>
<--秒殺時間js end-->
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。