Kuv tuaj yeem siv dab tsi los ntawm kev sau ntawv?
Kuv tuaj yeem siv dab tsi los ntawm kev sau ntawv?

Video: Kuv tuaj yeem siv dab tsi los ntawm kev sau ntawv?

Video: Kuv tuaj yeem siv dab tsi los ntawm kev sau ntawv?
Video: Tshuaj theem vim li cas thiaj tau nqi ?/ Siv kho mob dab tsi?/paris polyphylla use for? 2024, Kaum ib hlis
Anonim

Feem ntau, xwb ntawm ua ntaub ntawv . sau koj siv tau ib coElement. innerHTML los yog zoo dua, ntaub ntawv.

  • 'ua ntej': Ua ntej lub caij nws tus kheej.
  • 'afterbegin': Tsuas yog hauv lub caij, ua ntej nws thawj tus menyuam.
  • 'ua ntej': Tsuas yog hauv lub caij, tom qab nws tus menyuam kawg.
  • 'tom qab': Tom qab lub caij nws tus kheej.

Kuj nug, daim ntawv sau ua dab tsi?

HTML DOM sau () Txoj Kev The sau () txoj kev yog feem ntau yog siv rau kev sim: Yog tias nws yog siv tom qab HTML ntaub ntawv yog tag nrho loaded, nws yuav rho tawm tag nrho cov HTML uas twb muaj lawm. Nco tseg: Thaum txoj kev no yog tsis siv rau kev sim, nws yog feem ntau siv rau sau ib co ntawv mus rau ib tug tso zis kwj qhib los ntawm lub ntaub ntawv.

Tsis tas li ntawd, qhov txawv ntawm daim ntawv sau thiab innerHTML yog dab tsi? sau () muab cov ntsiab lus ncaj qha mus rau qhov browser uas tus neeg siv tuaj yeem pom nws. ntaub ntawv . innerHTML tab tom hloov HTML ntawm cov khoom koj siv rau. sau () tsis muaj HTML txuas nrog, tab sis yog tias koj twb muaj HTML uas koj xav hloov, ces ntaub ntawv.

Ua li no, vim li cas Document sau () tsis pom zoo ntxiv lawm?

Lwm qhov laj thawj tsis yog siv cov ntaub ntawv. write() yog nws tsis txhawb XHTML, tab sis nws tsis yog ib qho teeb meem txij li feem ntau lub vev xaib txhim kho siv HTML. sau () hluav taws tom qab ib nplooj ntawv tiav lawm, nws ua rau muaj teeb meem kev ua haujlwm thiab qee zaum, tej zaum yuav tsis yog txawm hluav taws tag nrho. Tsuas yog zoo li tsim nyog siv rau cov ntaub ntawv.

Dab tsi yog qhov txawv ntawm console log thiab cov ntaub ntawv sau hauv JavaScript?

Cov neeg tsim khoom siv lub console . log () rau kaw lus cov ntaub ntawv tseem ceeb. ntaub ntawv . sau hloov cov neeg siv pom hauv browser los ntawm kev ntxiv cov ntsiab lus ntxiv rau DOM.

Pom zoo: