Koj tab tom ua haujlwm ntawm kev tsim koj lub vev xaib thiab txiav txim siab tias nws yuav yog lub tswv yim zoo los nruab lub sijhawm lossis moos. Siv ib qho ntawm txoj kev teeb tsa, nyob ntawm koj nyiam.
Cov Lus Qhia
Kauj ruam 1
Nruab sijhawm qhia xov xwm nyob ntawm qhov chaw siv Yandex. Mus rau nplooj ntawv https://time.yandex.ru, xaiv ib qho ntawm cov tab hauv seem "Moos" - nrog cov xub (tsis tu ncua) lossis nrog cov lej (hluav taws xob). Nrhiav koj lub sijhawm thaj chaw. Qhov no tuaj yeem ua tiav los ntawm kev kuaj lub xov tooj hu mus tiv thaiv lub sijhawm ntawm lub computer lossis hovering nas tus cursor dhau daim duab. Tshuav nyem rau ntawm daim iav nyob rau sab xis sab sauv ntawm lub moos thiab xaiv ib qho kev ua los ntawm daim ntawv - "qhia rau lub xaib". Mus rau ntawm lub qhov rais nrog html code, luam nws. Nruab qhov chaws rau ntawm ntu ntawm koj qhov chaw xaiv rau lub moos.
Kauj ruam 2
Tshawb xyuas ib qho ntawm cov lus Askiv-Askiv uas muaj kev xaiv loj ntawm cov qauv sib txawv ntawm cov watches. Piv txwv, ntawm https://www.clocklink.com lossis https://toolshell.org. Xaiv ib qeb hauv cov ntawv qhia zaub mov, xyuas seb cov kev xaiv tau nthuav tawm, nrhiav "koj" saib. Nyem ntawm daim duab nrog lawv thiab mus rau nplooj ntawv pom zoo daim ntawv tso cai (ntawm https://www.clocklink.com) lossis sau npe (ntawm https://toolshell.org). Tau txais txoj cai, luam tawm nws thiab muab tshuaj txhuam nws hauv qhov chaw tsim kev saib xyuas ntawm koj lub vev xaib.
Kauj ruam 3
Tsim lub zog moos nrog Javascript hloov kho txhua thib ob. Teeb tsa cov teev hom qub: hh: mm: ss (piv txwv, 21:21:21), qhov twg h yog lub sijhawm hnub, m yog feeb, s yog vib nas this. Tsim nplooj ntawv yooj yim nrog rau "time.js" cov ntaub ntawv nrog Javascript code: Tso saib lub zog teev sij hawm Tam sim no
Kauj ruam 4
Tsim ib cov ntaub ntawv "time.js" nrog rau kev ua tiav ntawm lub sijhawm ua haujlwm txhua ob (1000ms), thiab tseem nrog kev tua lub sijhawm ua haujlwm thaum lub nplooj nkag. Ib qho ntxiv, tus cim “tick_tack” suav nrog hauv cov ntawv ntawm daim ntawv no.
Kauj ruam 5
Tso ob qho ntawm cov ntaub ntawv saum toj no hauv tib lub nplaub tshev thiab tom qab ntawd khiav "index.html" cov ntaub ntawv txhawm rau kuaj xyuas yog tias lub moos ua haujlwm. Yog tsis yog, txheeb xyuas Javascript puas hauv koj lub browser.