--- title: document.anchors slug: Web/API/Document/anchors tags: - DOM - Dokumentacja_Gecko_DOM - Gecko - Wszystkie_kategorie translation_of: Web/API/Document/anchors ---
{{ ApiRef() }}
anchors
zwraca listę wszystkich kotwic w dokumencie.
listaWęzłów = document.anchors
if ( document.anchors.length >= 5 ) {
dump("dump found too many anchors");
window.location = "http://www.google.com";
}
Ze względu na zgodność wsteczną, zwracany zestaw kotwic zawiera tylko kotwice posiadające atrybut name
, bez tych które posiadają jedynie atrybut id
.
{{ languages( { "en": "en/DOM/document.anchors", "es": "es/DOM/document.anchors", "ja": "ja/DOM/document.anchors" } ) }}