Cov ntawv sau yog cov kev kawm uas sau ua lus programming rau kev siv ntawm kev siv is taws nem. Txhawm rau sau ib tsab ntawv, koj yuav tsum sib sau nws cov cai rau hauv qhov chaw tsim nyog ntawm nplooj ntawv hauv cov kab lus HTML tsim nyog.
Cov Lus Qhia
Kauj ruam 1
Hauv Is Taws Nem cov kev siv JavaScript feem ntau yog siv los qhib cov ntawv sau. Cov lus programming no tso cai rau koj los ua ke nrog cov ntsiab lus nquag, ntawm qhov chaw uas cov ntawv qhia bar ua noj, muaj cov chaw cia nyob rau hauv.
Kauj ruam 2
Qhib cov nplooj ntawv HTML hauv txhua cov ntawv nyeem kho kom raug. Txhawm rau ua qhov no, koj tuaj yeem siv cov txheej txheem Windows Windows "Notepad", uas muaj thaum koj pib nyem rau ntawm cov ntaub ntawv thiab xaiv "Qhib Nrog" hauv cov ntawv qhia zaub mov. Txog kev kho kom yooj yim dua, koj tuaj yeem siv cov program me me Notepad ++, uas muaj cov haujlwm ua kom pom cov HTML thiab JavaScript code, uas yuav yooj yim rau koj los mus nrhiav cov code.
Kauj ruam 3
Koj yuav pom HTML hauv cov ntawv ntawm nplooj. Txhawm rau sau cov kab ntawv JavaScript, koj yuav tsum mus rau ntu thiab sau cov lej uas yuav tsum muaj. Piv txwv li:
Cov ntawv qhia zaub mov ntawv nyeem
Hauv qhov ua piv txwv no, koj tuaj yeem ncaj qha ntxig cov ntawv qhia zaub mov kom pom ntxiv rau ntawm nplooj ntawv.
Kauj ruam 4
Yog tias tsab ntawv raug faib ua JS cov ntaub ntawv, koj kuj tuaj yeem suav nrog nws hauv koj daim ntawv:
Hauv qhov xwm txheej no, "script_file" yog lub luag haujlwm rau txoj hauv kev uas cov ntawv sau nrog JS txuas ntxiv yog nyob ntawm cov nplooj ntawv hloov.
Kauj ruam 5
Yog li, yog tias koj theej koj cov ntawv sau npe script.js rau hauv tib lub nplaub tshev uas cov ntawv HTML nyob, koj tsuas yog xav sau:
Kauj Ruam 6
Tom qab kho cov ntaub ntawv thiab ua qhov tsim nyog hloov pauv rau nws, tseg cov ntaub ntawv siv "Cov Ntaub Ntawv" - "Txuag" ntawv qhia zaub mov thiab qhib cov nplooj ntawv hauv browser txhawm rau sim qhov kev tso nkag los ntawm txoj cai-nias ntawm daim HTML thiab xaiv "Qhib nrog ".