JavaScript Reference/Javascript Collections/anchors

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

"anchors" Example

   <source lang="javascript">
   

<html> <body> <a href="http://www.wbex.ru/" id="wbex">www.wbex.ru</a> <input type="button"

      value="Retrieve the number of anchors in this document" 
      onclick="alert(document.anchors.length);">

</body> </html>


     </source>
   
  


"anchors" is applied to

   <source lang="javascript">

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

     </source>
   
  


"anchors" JavaScript properties and JavaScript methods

   <source lang="javascript">

JavaScript properties and JavaScript methods

item(), length, namedItem(), tags(), urns()


     </source>
   
  


"anchors" Syntax Parameters and Note

   <source lang="javascript">

Note: Returns an array of all <a> elements in the document.

Syntax:

document.anchors // returns all anchors document.anchors(param1, param2) // returns an individual anchor

   param1    Required; zero-based index or 
                       desired member"s id or name attribute.
                       
   param2    Optional; zero-based index for the result returned
                       if param1 matches more than one element.
   
     
     </source>