document.all.tags()

JScript 3.0+ IE 4+ Syntax

document.all.tags(tag)

Description

The tags() method provides a way to retrieve all HTML elements of a particular tag type from the document.all array. The method returns an array of elements.

Example

Listing 7.52 uses the tags() method to create an array of all the anchor tags in the document. Using dot notation, the name of the first anchor in the temporary array is used to create a link to the top of the page.

Listing 7.52 Using the tags() Method to Find HTML Elements with a Particular Tag
 <html> <a name="Paint"><h2><u>Paint Colors</u></h2></a> Red<br> Green<br> Blue<br> Orange<br> <hr> <script language="JavaScript"> <!-- Hide //Get all the anchor tags var arrayOfAnchors = document.all.tags("A"); ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.