神馬js都是浮雲—–限時秒殺

買瞭本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.aiwalls.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

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *