
The element object interface provides the ability to programmatically access the properties and methods that are common to all element objects.
IHTMLElement Methods
HRESULT setAttribute(
BSTR strAttributeName,
VARIANT AttributeValue,
VARIANT_BOOL fCaseSensitive
);
Sets the value of the given attribute. If the attribute is not already present, the method adds the attribute to the element and sets the value.
Be careful when spelling attribute names. If fCaseSensitive is TRUE and strAttributeName does not have the same uppercase and lowercase letters as the attribute, this method creates a new attribute.
If two or more attributes have the same name (differing only in uppercase and lowercase letters) and fCaseSensitive is FALSE, this method assigns values only to the first attribute (the first to be created with this name). All other attributes of the same name are ignored.
See also getAttribute
HRESULT getAttribute(
BSTR strAttributeName,
LONG fFlags,
VARIANT *AttributeValue
);
Retrieves the value of the given attribute.
If two or more attributes have the same name (differing only in uppercase and lowercase letters) and fFlags is FALSE, this method retrieves values only for the last attribute (the last to be created with this name). All other attributes of the same name are ignored.
See also setAttribute
HRESULT removeAttribute(
BSTR strAttributeName,
VARIANT_BOOL fCaseSensitive,
VARIANT_BOOL *pfSuccess
);
Removes the given attribute from the element.
If two or more attributes have the same name (differing only in uppercase and lowercase letters) and fCaseSensitive is FALSE, this method removes only the last attribute (the last to be created with this name). All other attributes of the same name are ignored.
HRESULT put_className(
BSTR v
);
Sets the value of the className property of the object. The property is typically used to associate a particular style rule in a style sheet with the object.
By default, the property is equal to the string assigned to the className property of the given object, or is an empty string if the attribute is not explicitly assigned.
See also get_className
HRESULT get_className(
BSTR *p
);
Retrieves the value of the className property of the given object. The property is typically used to associate a particular style rule in a style sheet with the object.
By default, the value is equal to the string assigned to the className property of the given object, or is an empty string if the property is not explicitly assigned.
See also put_className
HRESULT put_id(
BSTR v
);
Sets the value of the id property for the object. The property is an SGML identifier used as the target for hypertext links or for naming particular objects in associated style sheets.
The value of the id property should be unique throughout the scope of the current document. If there is more than one object with the same identifier, a collection of those named items is created that can only be referenced by ordinal position.
See also get_id
HRESULT get_id(
BSTR *p
);
Retrieves the value of the id property for the object. The property is an SGML identifier used as the target for hypertext links or for naming particular objects in associated style sheets.
The value of the id property should be unique throughout the scope of the current document. If there is more than one object with the same identifier, a collection of those named items is created that can only be referenced by ordinal position.
See also put_id
HRESULT get_tagName(
BSTR *p
);
Retrieves the name of the current object.
HRESULT get_parentElement(
IHTMLElement **p
);
Retrieves an interface pointer that provides access to the parent object's properties and methods.
HRESULT get_style(
IHTMLStyle **p
);
Retrieves an inline style sheet for the tag.
HRESULT put_onhelp(
VARIANT v
);
Sets the inline script associated with the onhelp event on the object.
See also get_onhelp
HRESULT get_onhelp(
VARIANT *p);
Retrieves the inline script associated with the onhelp event on the object.
See also put_onhelp
HRESULT put_onclick(
VARIANT v
);
Sets the inline script associated with the onclick event on the object.
See also get_onclick
HRESULT get_onclick(
VARIANT *p
);
Retrieves the inline script associated with the onclick event on the object.
See also put_onclick
HRESULT put_ondblclick(
VARIANT v
);
Sets the inline script associated with the ondblclick event on the object.
See also get_ondblclick
HRESULT get_ondblclick(
VARIANT *p
);
Retrieves the inline script associated with the ondblclick event on the object.
See also put_ondblclick
HRESULT put_onkeydown(
VARIANT v
);
Sets the inline script associated with the onkeydown event on the object.
See also get_onkeydown
HRESULT get_onkeydown(
VARIANT *p
);
Retrieves the inline script associated with the onkeydown event on the object.
See also put_onkeydown
HRESULT put_onkeyup(
VARIANT v
);
Sets the inline script associated with the onkeyup event on the object.
See also get_onkeyup
HRESULT get_onkeyup(
VARIANT *p
);
Retrieves the inline script associated with the onkeyup event on the object.
See also put_onkeyup
HRESULT put_onkeypress(
VARIANT v
);
Sets the inline script associated with the onkeypress event on the object.
See also get_onkeypress
HRESULT get_onkeypress(
VARIANT *p
);
Retrieves the inline script associated with the onkeypress event on the object.
See also put_onkeypress
HRESULT put_onmouseout(
VARIANT v
);
Sets the inline script associated with the onmouseout event on the object.
See also get_onmouseout
HRESULT get_onmouseout(
VARIANT *p
);
Retrieves the inline script associated with the onmouseout event on the object.
See also put_onmouseout
HRESULT put_onmouseover(
VARIANT v
);
Sets the inline script associated with the onmouseover event on the object.
See also get_onmouseover
HRESULT get_onmouseover(
VARIANT *p
);
Retrieves the inline script associated with the onkeyup event on the object.
See also put_onmouseover
HRESULT put_onmousemove(
VARIANT v
);
Sets the inline script associated with the onmousemove event on the object.
See also get_onmousemove
HRESULT get_onmousemove(
VARIANT *p
);
Retrieves the inline script associated with the onmousemove event on the object.
See also put_onmousemove
HRESULT put_onmousedown(
VARIANT v
);
Sets the inline script associated with the onmousedown event on the object.
See also get_onmousedown
HRESULT get_onmousedown(
VARIANT *p
);
Retrieves the inline script associated with the onmousedown event on the object.
See also put_onmousedown
HRESULT put_onmouseup(
VARIANT v
);
Sets the inline script associated with the onmouseup event on the object.
See also get_onmouseup
HRESULT get_onmouseup(
VARIANT *p
);
Retrieves the inline script associated with the onmouseup event on the object.
See also put_onmouseup
HRESULT get_document(
IDispatch **p
);
Retrieves an interface pointer that provides access to the document object's properties and methods.
See also IHTMLDocument2
HRESULT put_title(
BSTR v
);
Sets the title of the style sheet.
The application of individual style sheets can be turned on and off dynamically. Note that the value of this property is also controlled by whether titled style sheets are applied.
See also get_title
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.