溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

js實(shí)現(xiàn)-限時(shí)搶購(gòu)倒計(jì)時(shí)間表

發(fā)布時(shí)間:2020-06-28 14:28:17 來源:網(wǎng)絡(luò) 閱讀:1881 作者:ljheee 欄目:開發(fā)技術(shù)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>限時(shí)搶購(gòu)倒計(jì)時(shí)間表</title>

<style type="text/css">
*{margin:0;padding:0;}
#content{width:300px;margin:0 auto;padding:10px;background:#eee;border:1px solid #999;}
#content p span{color:red;font:bold 20px Arial;}
#content p a{font:12px/23px '宋體';color:#888;}
.div1{ display:none;}
</style>

<SCRIPT LANGUAGE="JavaScript">
function fresh()
{
        var endtime=new Date("2110/11/06,12:20:12");
        var nowtime = new Date();
        var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
        d=parseInt(leftsecond/3600/24);
        h=parseInt((leftsecond/3600)%24);
        m=parseInt((leftsecond/60)%60);
        s=parseInt(leftsecond%60);
       
//        document.getElementById("times").innerHTML=__h+"小時(shí)"+__m+"分"+__s+"秒";
document.getElementById("times").innerHTML=h+"小時(shí)"+m+"分"+s+"秒";
        if(leftsecond<=0){
        	document.getElementById("times").innerHTML="已結(jié)束";
        	clearInterval(sh);
        }
}
var sh;
sh=setInterval(fresh,1000);
</SCRIPT>
</head>

<body>
<div id="content">
<h2>限時(shí)搶購(gòu)啦!</h2>
<p>還剩<span id="times"></span></p>
</div>
</body>
</html>


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI