Retrieves a collection of objects that have the specified HTML tag name.
dhtml语法
collElements = object.tags(sTag)
Parameters
sTag |
Required.
Variant of type Stringthat 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.
DHTML代码范例
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>
是否符合公共标准
There is no public standard that applies to this method.
Applies To
|
all,
anchors,
applets,
areas,
boundElements,
cells,
children,
elements,
embeds,
forms,
images,
links,
options,
plugins,
rows,
scripts,
tBodies |
|