Ntawm ntau qhov chaw, koj tuaj yeem pom lub timer suav mus txog rau thaum muaj ib qho xwm txheej tshwm sim. Qhov no tuaj yeem yog lub sijhawm kawg ntawm cov nyiaj cheb lossis lub sijhawm seem kom txog thaum Lub Xyoo Tshiab. Cov timers zoo li no tau tshaj tawm zoo tshaj plaws uas txhawb qhov kev ua ntawm cov neeg yuav khoom / cov neeg xa khoom, nrog rau kev sib cuam tshuam zoo rau ntau qhov chaw.
Tsim nyog
ib tsab ntawv timer timer
Cov Lus Qhia
Kauj ruam 1
Txhawm rau muab cov timer hauv koj lub vev xaib, ua ntej rub tawm tsab ntawv timer timer. Tom qab ntawv teeb tsa ob qho kev ntsuas nyob hauv nws: hnub suav hnub thiab hnub sib ntxig uas yuav qhia thaum hnub no los txog.
Kauj ruam 2
Qhib cov ntawv luam uas tau rub tawm, koj yuav pom 2 cov ntawv: ib tus muaj cov tsab ntawv countdown.js, thiab lwm qhov ua qhov piv txwv ntawm nplooj ntawv uas cov ntawv sau no txuas nrog - index.html. Ua ntej tshaj, rho tawm cov ntaub ntawv los ntawm lub khaib.
Kauj ruam 3
Siv Notepad los kho cov ntawv sau. Txhawm rau qhib cov ntaub ntawv teev tseg hauv Lus Cim, nyem-nias rau nws. Hauv cov ntawv qhia zaub mov uas tshwm, xaiv cov khoom "Qhib", tom qab ntawd xaiv "nrog - Notepad".
Kauj ruam 4
Kho thawj kab thawj ntawm daim ntawv thaum pib: var eventstr = "Nyob Zoo Xyoo Tshiab!". Daim ntawv no yuav tshwm rau tom kawg ntawm kev suav. Qhov thib ob kab nrog hnub tim suav hnub yog nyob ntawm qhov kawg ntawm cov ntaub ntawv thiab zoo li qhov no: CountDowndmn (2011, 1, 1) hauv hom xyoo, hli, hnub.
Kauj ruam 5
Hloov kho cov ntawv tawg, uas tseem nyob ntawm qhov kawg ntawm cov ntaub ntawv, me ntsis saum toj no suav hnub tim: countdownid.innerHTML = "+ hnub +" "+ hnub +", "+ dhour +" "+ dhourstr +", "+ dmin + " "+ dminstr +" thiab "+ dsec +" "+ dsecstr.
Kauj Ruam 6
Txuag cov ntawv tsim tawm thiab muab tso rau hauv cov ntawv sau npe uas nplooj ntawm koj tus xaib nyob qhov twg, qhov twg tus timer yuav muab tso rau. Hauv lwm lo lus, timer nplooj ntawv thiab ntawv sau ua ke yuav tsum yog cov npe tib yam.
Kauj Ruam 7
Tom ntej no, hauv qhov chaw yooj yim tso lub timer, nyob hauv txoj cai ntawm koj nplooj ntawv, tso 2 kab:
DIV "chaw" ID = "suav txheeb">.
Kauj ruam 8
Thawj kab yog lub luag haujlwm rau cov lus txib kom tsim tawm lub sijhawm. Qhov thib ob yog rau txuas tsab ntawv tsim.
Kauj Ruam 9
Txheeb xyuas koj lub timer ua haujlwm. Yog tias txhua yam ua tiav zoo, tom qab ntawd koj yuav pom kev countdown hauv qhov chaw zoo nyob rau nplooj ntawv ntawm koj lub xaib.