IHTMLElementCollection3::namedItem Method

Retrieves a form object or an object from an elements collection.


HRESULT namedItem(
    BSTR name,
    IDispatch **pdisp


[in] A BSTR that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.
[out, retval] The address of a pointer to a variable that receives an IDispatch interface for the object or collection if successful, or NULL otherwise.

Return Value

Returns S_OK if successful, or an error value otherwise.


The IHTMLElementCollection3::namedItem method was introduced in Microsoft Internet Explorer 6

This method first searches for an object with a matching id attribute. If a match is not found, then the method searches for an object with a matching name attribute, but only on those elements that are allowed a name attribute.