JavaScript Tutorial/Document/all

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

document.all

Syntax



   <source lang="javascript">

document.all[index]</source>


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

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

document.all.item()

Syntax



   <source lang="javascript">

document.all.item(name)</source>


document.all.tags()

Syntax



   <source lang="javascript">

document.all.tags(tag)</source>


List all elements by reference the document.all

   <source lang="javascript">

<html> <head> <title>A Simple Page</title> <script language="JavaScript">

</script> </head> <body onload="findhead1()">

Heading One

</body> </html></source>


Use document.all(elementId) to get the element

   <source lang="javascript">

<html> <head> <title>A Simple Page</title> <script language="JavaScript">

</script> </head> <body onload="findhead1()">

Heading One

</body> </html></source>