第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

JQuery倒計(jì)時(shí)和按照指定長(zhǎng)度為數(shù)字前面補(bǔ)零

標(biāo)簽:
JQuery

JQuery按照指定长度为数字前面补零

function PrefixInteger(num, length) {    return (Array(length).join('0') + num).slice(-length);}

PrefixInteger(8,2); 返回08,表示长度为2,数字8前面补一个0。

JQuery倒计时

var rest = 4350859;  //时间戳console.log(rest);$day = Math.floor(rest/(60*60*24));console.log($day);$hour = Math.floor((rest - $day * (60*60*24))/(60*60));console.log($hour);$minite = Math.floor((rest - $day * (60*60*24) - $hour * (60*60))/60);console.log($minite);$second = Math.floor(rest - $day * (60*60*24) - $hour * (60*60) - $minite * 60);console.log($second);$day = PrefixInteger($day,2);$hour = PrefixInteger($hour,2);$minite = PrefixInteger($minite,2);$second = PrefixInteger($second,2);$("#my_day").html($day);$("#my_hour").html($hour);$("#my_minite").html($minite);$("#my_second").html($second);window.setInterval(function(){     rest--;    console.log(rest);    $day = Math.floor(rest/(60*60*24));    console.log($day);    $hour = Math.floor((rest - $day * (60*60*24))/(60*60));    console.log($hour);    $minite = Math.floor((rest - $day * (60*60*24) - $hour * (60*60))/60);    console.log($minite);    $second = Math.floor(rest - $day * (60*60*24) - $hour * (60*60) - $minite * 60);    console.log($second);    $day = PrefixInteger($day,2);    $hour = PrefixInteger($hour,2);    $minite = PrefixInteger($minite,2);    $second = PrefixInteger($second,2);    $("#my_day").html($day);    $("#my_hour").html($hour);    $("#my_minite").html($minite);    $("#my_second").html($second);},1000);
html代码:<ul class="countdown">    <li> <span class="days" id="my_day">00</span>        <p class="days_ref">天</p>    </li>    <li class="seperator">.</li>    <li> <span class="hours" id="my_hour">00</span>        <p class="hours_ref">时</p>    </li>    <li class="seperator">:</li>    <li> <span class="minutes" id="my_minite">00</span>        <p class="minutes_ref">分</p>    </li>    <li class="seperator">:</li>    <li> <span class="seconds" id="my_second">00</span>        <p class="seconds_ref">秒</p>    </li></ul>

这样倒计时功能就完成了,这里css样式就需要大家自己去写了!!!j_0059.gifj_0039.gif


點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫(xiě)下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶(hù)
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專(zhuān)欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消