tags Method
Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


tags Method

Retrieves a collection of objects that have the specified HTML tag name.

Syntax

collElements = object.tags( sTag )

Parameters

sTag Required. Variant of type String  that specifies an HTML tag. It can be any one of the objects exposed by the DHTML Object Model.

Return Value

Returns a collection of element objects if successful, or null otherwise.

Remarks

This method returns an empty collection if no elements having the given name are found. Use the length property on the collection to determine the number of elements it contains.

Example

This example uses the tags method to retrieve a collection of all p elements in the document, and then uses the textDecoration property to underline each element.

<SCRIPT LANGUAGE="JScript">
var coll = document.all. tags ("P");
if (coll!=null) { for (i=0; i<coll.length; i++)
coll[i].style.textDecoration="underline"; }
</SCRIPT>

Standards Information

There is no public standard that applies to this method.

Applies To

Platform Version
Win16:
Win32:
Windows CE:
Unix:
Mac:
 
all , anchors , applets , areas , boundElements , cells , children , elements , embeds , forms , images , links , options , plugins , rows , scripts , tBodies
Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.