Targeting Links nyob rau hauv HTML IFrames thiab Frames

Qhib cov chaw uas koj xav tau

Thaum koj tsim ib daim ntawv los ua hauv ib qho IFRAME, txhua qhov kev sib txuas hauv cov kablus ntawd yuav qhib rau tib tus ncej. Tab sis nrog tus cwj pwm ntawm qhov txuas (lub caij los sis lub caij) koj tuaj yeem txiav txim siab tias qhov twg koj cov kev txuas yuav tsum qhib.

Koj tuaj yeem xaiv muab koj iframes lub npe tshwj xeeb nrog tus cwj pwm thiab ces taw tes koj cov kev sib txuas ntawm cov kablus nrog tus ID raws li tus nqi ntawm lub hom phiaj tseem ceeb:

id = "nplooj">
phiaj = "nplooj">

Yog tias koj ntxiv ib lub hom phiaj rau tus ID uas tsis muaj nyob rau hauv qhov kev sib kho tam sim no, qhov no yuav qhib qhov txuas rau hauv lub qhov rais tshiab, nrog lub npe ntawd. Tom qab thawj zaug, txhua cov kev txuas uas taw tes rau qhov chaw teev npe ntawd yuav qhib rau tib qhov rais tshiab.

Tab sis yog tias koj tsis xav tau lub npe txhua qhov rai los sis txhua daim duab nrog tus ID, koj tuaj yeem npaj qee cov qhov rais tshwj tsis yog tias xav tau lub qhov rais los yog thav duab. Cov no yog hu ua lub hom phiaj txheem.

Lub Plaub Lub Hom Phiaj Keywords

Muaj plaub lub ntsiab lus tseem ceeb uas tsis tas yuav tsum muaj lub npe hu ua. Cov ntsiab lus no cia koj qhib kev mus rau hauv cov chaw hauv lub qhov web browser qhov rai uas tsis muaj tus ID nrog lawv. Cov no yog cov hom phiaj uas cov web browsers paub txog:

Yuav Xaiv Koj Cov Npe Ntawm Koj Lub Npe Li Cas

Thaum koj tsim ib qhov web page nrog iframes, nws yog ib lub tswv yim zoo rau txhua tus ib lub npe tshwj xeeb. Qhov no yuav pab kom koj nco qab tias lawv yog dab tsi thiab tso cai rau koj xa cov kev mus rau cov kev cai.

Kuv nyiam lub npe yog kuv cov lus forrames rau lawv yog dab tsi. Piv txwv li:

id = "links">
id = "sab nraud-ntaub ntawv">

Siv HTML Ntoo Cov Hom Phaj

HTML5 ua cov ntas thiab cov kab tshuam dhau los, tab sis yog tias koj tseem siv HTML 4.01, koj tuaj yeem npaj cov ntsiab lus qis rau tib txoj kev koj sim iframes. Koj muab cov npe ntas nrog daim id tus cwj pwm:

id = "myFrame">

Tom qab ntawd, thaum twg ib qhov txuas rau lwm lub thav duab (lossis qhov rais) muaj tib lub hom phiaj, qhov txuas yuav qhib rau hauv kablus ntawd:

phiaj = "myFrame">

Plaub lub ntsiab lus tseem ceeb ua haujlwm nrog cov ntas. Lub _parent qhib nyob rau hauv qhov txheej txheem ntawm tus kheej, _self qhib rau tib tus ncej, _top opens nyob rau hauv tib lub qhov rai, tab sis sab nraum cov frameset, thiab _blank opens hauv lub qhov rais tshiab los yog tab (nyob ntawm qhov browser).

Teem ib lub Hom Phiaj Tseeb

Koj tuaj yeem teem caij rau koj lub vas sab uas siv lub npe. Koj teev cov cim kev xa mus rau lub npe ntawm iframe (los yog thav duab hauv HTML 4.01) koj xav tau txhua qhov txuas mus qhib rau hauv. Koj tuaj yeem teev cov kev tsim cov hom phiaj ntawm ib qho ntawm plaub lub ntsiab lus tseem ceeb.

Ntawm no yog yuav ua li cas sau ib lub hom phiaj tsim nyog rau ib nplooj ntawv:

Lub caij nyob hauv lub taub hau ntawm koj daim ntawv. Nws yog ib qho void element, li hauv XHTML, koj yuav muaj xws li kaw qhov luaj li:

/>