Yuav Ua Li Cas Sau Ib Tsab Ntawv

Cov txheej txheem:

Yuav Ua Li Cas Sau Ib Tsab Ntawv
Yuav Ua Li Cas Sau Ib Tsab Ntawv

Video: Yuav Ua Li Cas Sau Ib Tsab Ntawv

Video: Yuav Ua Li Cas Sau Ib Tsab Ntawv
Video: kablia vwj poj niam li kuv tau mus lawm tsis rov los Nkaujtawm tshiab 2021-2022 2024, Hlis ntuj nqeg
Anonim

Hauv Is Taws Nem niaj hnub no, tag nrho cov kev sib cuam tshuam - koj yuav tsum siv zog nrhiav qhov tsawg kawg ntawm qee qhov chaw uas tsis muab tus qhua los ua qee yam thiab tam sim ntawd tau txais lus teb los ntawm lub xaib. Txawm li cas los xij, feem ntau peb tsis txawm tias yuav sau los yog nias dab tsi - nplooj ntawv nws tus kheej cuam tshuam rau kev txav ntawm tus cursor thiab, qee lub sijhawm, koj taug kev los ntawm cov nplooj ntawv zoo li yog los ntawm minefield. Txhua qhov sib cuam tshuam ntawm cov xaib yog muab los ntawm cov ntawv sau. Cov no tuaj yeem yog ob qho ntawv sau ua rau ntawm lub server thiab cov uas tua ntawm peb lub khoos phis tawm. Cia peb sim sau tus qauv yooj yim kom tau ib lub tswv yim ntawm qhov nws ua tau yog.

Yuav ua li cas sau ib tsab ntawv
Yuav ua li cas sau ib tsab ntawv

Cov Lus Qhia

Kauj ruam 1

Lo lus ntawm tsab ntawv nws tus kheej txhais tau tias yog "tsab ntawv", uas yog, piav qhia ntawm kab lus ntawm kev nqis tes ua kom ua tiav txoj haujlwm. Cov thawj coj ntawm cov ntawv no tuaj yeem yog cov qauv ntawm lub server software, lossis browser ntawm peb lub computer. Txij li qhov browser, tsis li rau lub web server, yog ib txwm nyob ntawm tes, cia sau ntawv hauv cov lus uas qhov browser nkag siab - JavaScript. Txhua cov ntawv kho phau ntawv yog txaus rau qhov no - ib tus qauv notepad zoo. Tau kawg, rau qhov kev zov me nyuam ntawm cov ntawv sau, koj tsis tuaj yeem ua yam tsis muaj ib tus kws kho tshwj xeeb. Xws li cov ntawv sau tau txhim kho cov kev ua haujlwm niaj hnub ntawm kev sau ntawv sau, sau tawm koj lub taub hau dawb rau kev tsim kho.

Kauj ruam 2

Rau qhov browser kom nyeem, nkag siab, thiab ua txoj haujlwm, yuav tsum sau thiab sau raws li cov cai uas muaj los ntawm qhov browser cuam txhais cov lus txhais lus. Thawj kab yog qhia rau tus neeg ua yeeb yam tias tsab ntawv pib txij no. Hauv JavaScript, qhov qhib pib no tuaj yeem saib zoo li no: Thiab daim ntawv cim npe kaw zoo li no: Ntawm ob daim pib no yog cov lus qhia - cov neeg ua haujlwm hais lus. Piv txwv li, cov lus qhia teeb tsa rau browser kom luam tawm lub sijhawm tam sim no nyob hauv HOUR: MINUTE format zoo li no: var aTime = hnub Tshiab ();

document.write ("Tam sim no" + aTime.getHours () + ":" + aTime.getMinutes ()); Ntawm no yog thawj kab var aTime = tshiab Hnub () qhia tus sau tsab ntawv los tsim lub virtual kwv hu ua "aTime". Qhov khoom no sawv cev rau hnub thiab lub sijhawm tam sim no. document.write () yog ib qho lus txib kom luam tawm hauv nplooj ntawv yog dab tsi tau qhia nyob rau kev thaiv kab lus hauv qab no, thiab aTime.getHours () thiab aTime.getMinutes () cov lus qhia kom rov qab teev tam sim no thiab feeb los ntawm lub "aTime". Lub + tus ua haujlwm txuas cov kab ntawv tag nrho kom muab luam tawm rau ib kab. Thaum sib sau ua ke, tsab ntawv JavaSript yooj yim no yuav zoo li no:

var aTime = tshiab Hnub ();

daim ntawv sau. Qhov chaw ("Tam sim no" + aTime.getHours () + ":" + aTime.getMinutes ());

Kauj ruam 3

Nws tseem khaws cov cai no rau hauv cov ntaub ntawv nrog htm txuas ntxiv lossis html txuas ntxiv (HyperText Markup Language), lub operating system lees paub cov hom ntawv thiab hloov nws rau kev ua tiav rau qhov program uas tau muab cov hom file no - browser. Raws li qhov tshwm sim, peb cov tsab ntawv yuav nyeem thiab ua tiav los ntawm tus neeg txhais lus txhais lus thiab nthuav tawm hauv qhov browser browser raws li hauv qab no:

Pom zoo: