IHTMLElementCollection

IHTMLElementCollection


This interface provides access to a collection of element objects.

This collection is indexed first by name, then by id. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

A zero-based collection, in source order, of all elements in a given form. This collection can contain any combination of INPUT, SELECT, and TEXTAREA elements.

IHTMLElementCollection Methods
toString   put_length   get_length  
get__newEnum   item   tags  

IHTMLElementCollection::toString

HRESULT toString(
    BSTR *String
);

Retrieves a string representation of the element collection object.

String
Address of a string variable that receives the string representation.

IHTMLElementCollection::put_length

HRESULT put_length(
    long v
);

Sets the size, in objects, of the collection.

v
Long integer value specifying the number of elements.

See also get_length

IHTMLElementCollection::get_length

HRESULT get_length(
    long *p
);

Retrieves the number of objects in the collection.

p
Address of a long integer variable that receives the number of elements.

See also put_length

IHTMLElementCollection::get__newEnum

HRESULT get__newEnum(
    IUnknown **p
);

Retrieves an enumerator for the collection.

p
Address of a pointer to the IUnknown interface of the enumerator.

IHTMLElementCollection::item

HRESULT item(
    VARIANT name,
    VARIANT index,
    IDispatch **pdisp
);

Retrieves an object or a collection from the given collection. The name determines which action to take.

name
VARIANT structure containing a string or value specifying the object or collection to retrieve. If this parameter is a number, the method returns the object in the collection at the given position, where the first object has value 0, the second has 1, and so on. If this parameter contains a string, the method returns a collection of objects, where the value of the name or id property for each object is equal to the string.
index
VARIANT structure containing a value specifying the position of an object to retrieve. This parameter is used when name is a string. The method uses the string to construct a collection of all objects that have a name or id equal to the string, then retrieves from this collection the element at the position specified by index.
pdisp
Address of the IDispatch interface of the collection or object.

IHTMLElementCollection::tags

HRESULT tags(
    VARIANT tagName,
    IDispatch **pdisp
);

Retrieves a collection of all objects in the given collection that have the given HTML tag name.

tagName
VARIANT structure containing a string specifying the HTML tag name of the objects to retrieve.
pdisp
Address of the IDispatch interface of the collection.

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

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.