List all elements by reference the document.all : all « Document « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function findhead1()
{
    var tag, tags;
    tags = "The tags in the page are:"
    for(i = 0; i < document.all.length; i++)
    {
        tag = document.all(i).tagName;
        tags = tags + "\r" + tag;
    }
    document.write(tags);
}

//  -->
</script>
</head>
<body onload="findhead1()">
<h1>Heading One</h1>
</body>
</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