HTML DOM Document anchors attribute
- Zurück zur vorherigen Seite adoptNode()
- Nächste Seite Applets
- Zurück zur vorherigen Ebene HTML DOM Documents
Definition and Usage
Not recommended anchors
attribute. Please do not use it.
anchors
The attribute only returns those <a> elements that have the name attribute.
HTML5 does not support the name attribute of <a> elements.
Alternative:
Number of <a> elements in the document:
let num = document.getElementsByTagName("a").length;
Content of the first <a> element:
let content = document.getElementsByTagName("a")[0].innerHTML;
See also:
Instance
Example 1
Number of <a> elements in the document:
let num = document.anchors.length;
Example 2
Content of the first <a> element:
let content = document.anchors[0].innerHTML;
Syntax
document.anchors
Parameter
Keine.
Rückgabewert
Typ | Beschreibung |
---|---|
Objekt | HTMLCollection aller <a>-Elemente im Dokument, die das name-Attribut haben. |
- Zurück zur vorherigen Seite adoptNode()
- Nächste Seite Applets
- Zurück zur vorherigen Ebene HTML DOM Documents