document.all : all « Document « JavaScript Tutorial






Syntax

document.all[index]

The document.all property is an array of all the HTML elements that are in the document.

The elements appear in the array in the order in which they were created.

Methods Associated with the document.all Array

MethodDescription
item()Returns an HTML element based on element's name
tags()Returns an array of elements that have the specified tag


<html>
    <a name="Paint"><h2><u>Paint Colors</u></h2></a>
    Red<br>
    Green<br>
    Blue<br>
    Orange<br>
    <hr>
    <script language="JavaScript">
    <!--

    document.write("<a href='#",document.all[4].name,"'>");   
    document.write(document.all[4].name,"</a>");              
    -->
    </script>
    </html>








14.3.all
14.3.1.document.all
14.3.2.document.all.item()
14.3.3.document.all.tags()
14.3.4.List all elements by reference the document.all
14.3.5.Use document.all(elementId) to get the element