Export (0) Print
Expand All

hasAttribute method

Determines whether an attribute with the specified name exists.

Document Object Model (DOM) Level 3 Core Specification, Section 1.4Internet Explorer 8

 

Syntax


HRESULT retVal = object.hasAttribute(name, pfHasAttribute);

Parameters

name [in]

Type: BSTR

BSTR that specifies the name of the attribute.

pfHasAttribute [out, retval]

Type: VARIANT_BOOL

VARIANT_FALSE (false)

The specified attribute does not exist.

VARIANT_TRUE (true)

The specified attribute exists.

Return value

Type: HRESULT

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

Standards information

Remarks

Windows Internet Explorer 8 and later. The IHTMLElement6::hasAttribute method requires IE8 Standards mode and is not supported in IE7 Standards mode or IE5 (Quirks) mode mode. For more information, see Defining Document Compatibility.

The IHTMLElement6::hasAttribute method tests for the existence of an attribute specified by name. The IHTMLElement6::hasAttributes method, on the other hand, determines whether the element has any attributes at all.

See also

Reference
getAttribute
IHTMLElement6::hasAttributes

 

 

Community Additions

ADD
Show:
© 2014 Microsoft