tags Method

MS Office DHTML, HTML & CSS

 
Click to return to the DHTML, HTML & CSS home page    
swapNode Method     taintEnabled Method     DHTML Methods    

tags Method


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

Syntax

collElements = object.tags(sTag)

Parameters

sTagRequired. 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>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
all, anchors, applets, areas, boundElements, cells, children, elements, embeds, forms, images, links, options, plugins, rows, scripts, tbodies

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.