神馬js都是浮雲-----限時秒殺

來源:互聯網
上載者:User

買了本js進階程式設計,看了一個多月仍然雲裡霧裡的,盼望著盼望著終於開了js的課,濤哥一講神馬js全都浮雲了,第一天的作業小小擴充了一下變成限時秒殺,圖片上不了,自己複製下來看吧,時間倉促沒有寫暫停功能
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>倒計時-限時秒殺</title>
</head>
<body>
<p><input type="text" id="nid" name="some_name" value="" style="font-size:100px;width:1300px"></p>
</body>
<script type="text/javascript" charset="utf-8">
var mytime=60*60*60*24*10;
var nid=document.getElementById("nid");
var dd,hh,mm,ss,ms;
function fun(){
if(mytime>0){
mytime--;
}    www.2cto.com
dd=Math.floor(mytime/(60*60*60*24));
hh=Math.floor((mytime-(dd*60*60*60*24))/(60*60*60));
hh=(hh<10)?"0"+hh:hh;
mm=Math.floor((mytime-(dd*60*60*60*24)-(hh*60*60*60))/(60*60));
mm=(mm<10)?"0"+mm:mm;
ss=Math.floor((mytime-(dd*60*60*60*24)-(hh*60*60*60)-(mm*60*60))/60);
ss=(ss<10)?"0"+ss:ss;
ms=Math.floor((mytime-(dd*60*60*60*24)-(hh*60*60*60)-(mm*60*60)-(ss*60)));
ms=(ms<10)?"0"+ms:ms;
nid.value="限時秒殺:"+dd+"天"+hh+":"+mm+":"+ss+":"+ms;
}
setInterval("fun()",10);
</script>
</html>
作者:zdrjlamp

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.