Kuv yuav tshem tawm DOM lub ntsiab li cas?
Kuv yuav tshem tawm DOM lub ntsiab li cas?

Video: Kuv yuav tshem tawm DOM lub ntsiab li cas?

Video: Kuv yuav tshem tawm DOM lub ntsiab li cas?
Video: Kuv Hmoov Phem Los Koj Siab Phem-LOKY(Official MV ) 2024, Kaum ib hlis
Anonim

Yog koj xav tau tshem tawm tus keeb los ntawm DOM tag nrho, koj tuaj yeem siv txoj kev tshem tawmChild(). var elem = document. querySelector('#qee- keeb '); elem. parentNode.

Xav txog qhov no, puas tso saib tsis muaj Tshem Tawm ntawm Dom?

Vim tso saib : tsis muaj ua tau tshem tawm cov ntsiab lus los ntawm DOM . visibility: zais cia li ua rau lawv pom tsis tau, tab sis lawv tseem nyob ntawd.

Ib yam li ntawd, DOM nodes yog dab tsi? A " node ", hauv cov ntsiab lus no, tsuas yog HTML keeb . Cov " DOM "yog cov qauv ntoo uas sawv cev rau HTML ntawm lub vev xaib, thiab txhua tus HTML keeb yog ib " node ". Saib Cov Ntaub Ntawv Tus Qauv Qauv ( DOM ). Tshwj xeeb tshaj yog, " Node " yog ib qho interface uas yog siv los ntawm ntau lwm yam khoom, suav nrog "cov ntaub ntawv" thiab " keeb ".

Nyob rau hauv no txoj kev, yuav ua li cas koj rho tawm ib lub caij los ntawm ib tug array?

Tshem tawm Ib Element Kev siv shift() Cov array txoj kev hloov pauv () thiab unshift() ua haujlwm ntawm qhov pib ntawm ib qho array hloov qhov kawg ntawm ib array , zoo li cov ntaub ntawv nrog push() thiab pop(). Lub shift() hais kom ua tshem tawm thawj keeb ntawm array thiab unshift() hais kom ua yuav ntxiv ib qho keeb mus rau qhov pib ntawm lub array.

Yuav ua li cas koj tshem tawm ib yam khoom los ntawm cov npe hauv Python?

Tshem tawm cov khoom los ntawm index los yog hlais: del clear(), pop() thiab tshem tawm () yog txoj kev lis , tab sis koj tuaj yeem ua tau tshem tawm cov ntsiab lus los ntawm a lis nrog del nqe lus. Qhia qhov yam khoom yuav deleted los ntawm index. Thawj qhov ntsuas yog 0, thiab qhov ntsuas kawg yog -1. Siv cov hlais, koj tuaj yeem rho tawm ntau yam khoom ib zaug.

Pom zoo: