JavaScript Reference/Javascript Collections/links

Материал из Web эксперт
Перейти к: навигация, поиск

"links" Example

    
<html>
<body>
<a href="http://www.wbex.ru">www.wbex.ru website</a>
<a href="http://www.wbex.ru">www.wbex.ru website</a>
<a href="http://www.wbex.ru">www.wbex.ru website</a>
<a href="http://www.wbex.ru">www.wbex.ru website</a>
<a href="http://www.wbex.ru">www.wbex.ru website</a>
<button onclick="alert(document.links.length);">
No. of links on page
</button>
</body>
</html>



"links" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |document                                                      |
+----------------+--------------------------------------------------------------+



"links" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem(), tags(), urns()



"links" Syntax Parameters and Note

Note:
Returns an array of all links in both the <a> and <area> elements in a document.
    
Syntax:
    
document.links // returns all links
document.links(param1) // returns an individual link
Parameters:
    param1   Required; the zero-based index