VBScript yog Windows lus ib txwm hais lus hom lus uas feem ntau siv los tsim cov ntawv thov web server. VBScript tau suav nrog hauv cov ntawv HTML, thiab yooj yim rau siv. Nco ntsoov tias VBScript tsis zoo ib yam li Visual Basic uas feem ntau yog siv rau kev tsim cov ntawv thov desktop.
Kauj ruam
Ntu 1 ntawm 5: Npaj Txoj Haujlwm Txhim Kho Ib puag ncig
Kauj Ruam 1. Tau txais tus lej zoo editor
Koj tuaj yeem siv Notepad, tab sis tus kws kho mob zoo dua yuav ua rau koj yooj yim dua los saib cov syntax ntawm koj li VBScript code.
Kauj Ruam 2. Nruab Internet Explorer
Internet Explorer yog qhov browser nkaus xwb uas txhawb nqa VBScript vim tias VBScript yog daim ntawv pov thawj Microsoft khoom. Koj xav tau Internet Explorer teeb tsa hauv koj lub khoos phis tawj kom pom cov txiaj ntsig ntawm kev khiav VBScript cov haujlwm.
Txij li Internet Explorer tsuas yog txhawb nqa ntawm Windows, koj tuaj yeem tau txais cov txiaj ntsig zoo tshaj plaws los ntawm kev tsim cov phiaj xwm siv lub khoos phis tawj Windows
Kauj Ruam 3. Kawm qee qhov pib yooj yim VBScript
Muaj qee qhov pib uas yuav pab tau yog tias koj paub lawv ua ntej nkag mus rau kev sau cov cai tob dhau.
- Siv '(ib nqe lus hais) los cim cov lus. Txhua kab pib nrog cov lus hais ib zaug yog cim raws li cov lus pom thiab tsis ua tiav los ntawm tsab ntawv. Siv cov lus pom ntau los pab lwm tus tsim tawm app thiab koj tus kheej nkag siab tias koj cov cai ua dab tsi.
- Siv _ (cim hauv qab) txuas ntxiv qhov kawg ntawm kab. Qhov kawg ntawm ib kab ntawm cov cai feem ntau yog qhia los ntawm kev txav mus rau kab tom ntej, tab sis yog tias kab ntawm kab ntawv koj tau sau ntev dhau thiab yuav tsum txuas ntxiv mus ntawm kab tom ntej, muab _ tom kawg ntawm kab uas tsis tiav qhia tias kab ntawm txoj cai yuav raug txuas ntxiv ntawm kab tom ntej.
Ntu 2 ntawm 5: Tsim Nplooj Ntawv Yooj Yim
Kauj ruam 1. Tsim ib nplooj ntawv HTML
VBScript muaj nyob hauv HTML cov vev xaib. Txhawm rau pom tias VBScript ua tau zoo li cas, koj yuav tsum tsim cov ntawv HTML uas tuaj yeem qhib nrog Internet Explorer. Qhib koj tus lej editor, tom qab ntawd nkag mus rau cov cai hauv qab no:
VBScript xeem Kauj Ruam 2. Ntxiv VBScript chij
Thaum tsim cov vev xaib siv VBScript, koj yuav tsum qhia rau lub browser tias tsab ntawv twg yuav tsum khiav. Ntxig tus chij hauv qab no rau hauv koj nplooj ntawv HTML:
VBScript xeem Kauj Ruam 3. Siv VBScript ntawm ASP server
Yog tias koj tab tom sau VBScript rau ASP server, koj tuaj yeem kos cim pib ntawm tsab ntawv siv tus chij tshwj xeeb:
VBScript xeem <% %>Ntu 3 ntawm 5: Tsim Txoj Haujlwm "Nyob Zoo Ntiaj Teb!"
Kauj Ruam 1. Nkag Mus Sau Cov lus txib
Cov lus txib no ua haujlwm los tso saib cov ntsiab lus rau tus neeg siv. Thaum siv Kev Sau Ntawv hais kom ua, cov ntawv tshwj xeeb yuav tshwm rau hauv qhov browser.
VBScript xeem Kauj Ruam 2. Ntxiv cov ntawv koj xav tso tawm
Sab hauv cov kab zauv, sau cov ntawv koj xav kom tshwm ntawm qhov screen. Tsis txhob hnov qab xa cov ntawv nrog cov lus hais los xaiv cov ntawv raws li cov ntaub ntawv ntawm hom hlua.
VBScript xeem Kauj Ruam 3. Qhib cov ntawv HTML nrog koj tus browser
Txuag koj cov cai ua. HTML cov ntaub ntawv. Qhib cov ntawv koj tau cawm siv Internet Explorer. Koj nplooj ntawv yuav tsum qhia Nyob Zoo Ntiaj Teb! hauv cov ntawv yooj yim.
Ntu 4 ntawm 5: Siv Cov Piv Txwv
Kauj Ruam 1. Pib los ntawm kev tshaj tawm koj cov kev hloov pauv
Koj tuaj yeem khaws cov ntaub ntawv hauv qhov sib txawv, tom qab ntawd koj tuaj yeem hu thiab siv lawv tom qab. Koj yuav tsum tshaj tawm cov kev hloov pauv siv dim ua ntej sau lawv nrog qhov muaj txiaj ntsig. Koj tuaj yeem tshaj tawm ntau qhov sib txawv ntawm ib zaug. Cov ntawv sib txawv yuav tsum pib nrog ib tsab ntawv, thiab tuaj yeem ntev txog 255 tus ntawv. Hauv qab no, peb tsim qhov "hnub nyoog" sib txawv:
VBScript xeem Kauj ruam 2. Sau tus nqi rau hauv qhov sib txawv
Tom qab tshaj tawm qhov sib txawv, koj tuaj yeem nkag mus rau qhov tseem ceeb hauv nws. Siv = kos npe los qhia tus nqi ntawm qhov sib txawv. Koj tuaj yeem siv Cov Lus txib sau kom pom cov kev hloov pauv ntawm lub vijtsam kom ntseeg tau tias txhua yam ua haujlwm tau zoo.
VBScript xeem Kauj Ruam 3. Sim tswj cov kev hloov pauv
Koj tuaj yeem siv cov lej lej los tswj cov kev hloov pauv. Cov lej lej siv ua haujlwm zoo li algebra yooj yim. Txhua qhov hloov pauv, suav nrog koj cov lus teb, yuav tsum tau tshaj tawm ua ntej siv.
VBScript xeem Kauj Ruam 4. Tsim ib qho array
Hauv qhov tseeb, Array yog lub rooj uas muaj ntau dua ib tus nqi. Tom qab ntawd, cov array tau ua raws li qhov sib txawv. Zoo li txhua qhov hloov pauv, arrays yuav tsum tau tshaj tawm ua ntej. Koj yuav tsum qhia tus lej ntawm cov txiaj ntsig uas cov khoom tuaj yeem khaws (suav nrog 0 ua thawj tus lej). Tom qab ntawd, koj tuaj yeem hu cov ntaub ntawv khaws cia hauv kab tom qab.
VBScript xeem Kauj Ruam 5. Tsim kom muaj ob seem duab
Koj tuaj yeem tsim cov arrays ntawm ntau qhov ntev los khaws cov ntaub ntawv ntau ntxiv. Thaum tshaj tawm ib qho array, koj yuav tsum qhia tus naj npawb ntawm kab thiab kab uas cov kab tuav.
VBScript xeem Ntu 5 ntawm 5: Siv Cov Txheej Txheem
Kauj Ruam 1. Nkag siab qhov sib txawv ntawm cov txheej txheem "sub" thiab "function"
Muaj ob hom txheej txheem hauv VBScript: sub thiab ua haujlwm. Ob hom txheej txheem no tso cai rau koj txoj haujlwm ua haujlwm.
- Cov txheej txheem hauv qab tuaj yeem ua cov haujlwm, tab sis tsis tuaj yeem rov qab qhov tseem ceeb rau txoj haujlwm.
- Cov txheej txheem kev ua haujlwm tuaj yeem ua cov haujlwm thiab rov ua qhov tseem ceeb rau txoj haujlwm.
Kauj Ruam 2. Tsim thiab hu rau cov txheej txheem sub
Koj tuaj yeem siv cov txheej txheem sub los tsim cov haujlwm uas koj qhov program tuaj yeem hu tom qab. Siv Sub thiab End Sub nqe lus los muab cov ntsiab lus ntawm cov txheej txheem sub. Siv Cov Lus Hais kom qhib qhov txheej txheem sub.
VBScript xeem Kauj Ruam 3. Tsim kom muaj txheej txheem ua haujlwm
Cov txheej txheem ua haujlwm tso cai rau koj ua cov lus txib thiab xa rov qab qhov tseem ceeb rau txoj haujlwm. Cov txheej txheem ua haujlwm yog qhov uas lub luag haujlwm tseem ceeb ntawm koj qhov haujlwm yuav ua. Siv Txoj Haujlwm thiab Xaus Cov Nqe Lus los muab cov ntsiab lus uas tau ua tiav hauv cov txheej txheem kev ua haujlwm.
VBScript xeem