English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
All browsers fully support the links property:the read-only attribute returns all<area>element and<A>a list of elements, where the href attribute has a value.
If the element is missinghrefIf the attribute is present, no content is returned.
The elements in the list are sorted in the order they appear in the source code.
Syntax:
var x = document.links.length;Test and see‹/›
Browser Compatibility
Property | |||||
All browsers fully support the links property: | links | links | links | links | links |
Property | Description |
---|---|
length | Returns the list of<a>and/or<area>Number of Elements |
Method | Description |
---|---|
[index) | Returns the specific node at the given index starting from zero in the list. If the index number is out of range, it returns null. |
item(index) | Returns the specific node at the given index starting from zero in the list. If the index number is out of range, it returns null. |
namedItem(id) | Returns a specific node whose ID name matches the string specified by name. If the id does not exist, it returns null. |
Return Value: | oneHTMLCollection, providing all <a> elements and/or list of <area> elements. |
---|---|
DOM Version: | DOM Level1 |
Find out how many links are in the document:
var x = document.links.length;Test and see‹/›