共用方式為


getNamedItem method

Gets an IHTMLDOMAttribute specified with the IHTMLDOMAttribute2::name property, by using the IHTMLAttributeCollection interface.

 

Syntax

IHTMLDOMAttribute retVal = object.getNamedItem(bstrName);

Parameters

Standards information

Remarks

If the IHTMLDOMAttribute applies to an element but is not specified, this method returns the IHTMLDOMAttribute with the specified name set to an empty string.

If the IHTMLDOMAttribute does not apply to the element and is not specified, then an error is returned.

If the IHTMLDOMAttribute does not apply to the element and is specified, then the IHTMLDOMAttribute with the specified name is returned.

Windows Internet Explorer 8 and later. In IE8 Standards mode, the IHTMLAttributeCollection4::getNamedItem method does not create Attr objects that do not exist in the collection; it returns NULL when an IHTMLDOMAttribute is not found. For more information on IE8 mode, see Defining Document Compatibility.

IHTMLAttributeCollection4::getNamedItem was introduced in Microsoft Internet Explorer 6.