Retrieves an object from the filters collection or various other collections.
dhtml语法
oitem = object.item(vindex)
parameters
vIndex |
Required.
Integer or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of
the object. If this parameter is a string, all objects with matching
name or id
properties are retrieved, and a collection is returned if more than one match is made. |
Return Value
Returns an object or a collection of objects if successful, otherwise null.
Examples
The following example uses the item method to retrieve each object from the document. In this case, the method parameter is a number, so the objects are retrieved in the order in which they appear in the document.
<SCRIPT LANGUAGE="JScript">
var oItem = document.all;
if (oItem!=null) {
for (i=0; i<oItem.length; i++)
alert(oItem.item(i).tagName);
}
</SCRIPT>
The next example uses the item method to retrieve a collection of all objects in the document that have "Sample" as an id. it then uses item again to retrieve each object from the "sample" collection.
<script language="jscript">
var oItem = document.all.item("Sample");
If (oItem != null) {
for (i=0; i<oItem.length; i++) {
alert(oItem.item(i).tagName);
}
}
</SCRIPT>
是否符合公共标准
There is no public standard that applies to this method.
Applies To