asp.net.ph

Skip Navigation Links

tags Method

DHTML Methods


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

Syntax

collElements = object.tags ( "sTag" ) 
Parameters

sTag Required. String specifying 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

The following JScript™ ( compatible with ECMA-262 language specification ) example retrieves a collection of all P elements in the document and then applies an underline to each.

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

all, anchors, applets, areas, boundElements, cells, childNodes, children, elements, embeds, filters, forms, frames, images, imports, links, options, plugins, rows, rules, scripts, styleSheets, tbodies



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note