共用方式為


namedItem method

Retrieves an object or a collection from a specified collection.

 

Syntax

HRESULT retVal = object.namedItem(name, pNode);

Parameters

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

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