共用方式為


setAttributeNode method

Sets an IHTMLDOMAttribute2 interface node as part of the object.

 

Syntax

HRESULT retVal = object.setAttributeNode(pattr, ppretAttribute);

Parameters

Exceptions

Exception Condition
WrongDocumentError 4

Raised if pattr was created from a different document than the calling element's parent document. Versions earlier than Internet Explorer 10 will throw the exception as WRONG_DOCUMENT_ERR.

NoModificationAllowedError 7

Raised if a read only attribute already exists with the same IHTMLDOMAttribute2::name as pattr. Versions earlier than Internet Explorer 10 will throw the exception as NO_MODIFICATION_ALLOWED_ERR.

InUseAttributeError 10

Raised if pattr is already assigned to an element object. Versions earlier than Internet Explorer 10 will throw the exception as INUSE_ATTRIBUTE_ERR.

 

Standards information

Remarks

IHTMLElement6::setAttributeNode was introduced in Microsoft Internet Explorer 6.