IHTMLElement

IHTMLElement


The element object interface provides the ability to programmatically access the properties and methods that are common to all element objects.

IHTMLElement Methods
setAttribute   getAttribute   removeAttribute  
put_className   get_className   put_id  
get_id   get_tagName   get_parentElement  
get_style   put_onhelp   get_onhelp  
put_onclick   get_onclick   put_ondblclick  
get_ondblclick   put_onkeydown   get_onkeydown  
put_onkeyup   get_onkeyup   put_onkeypress  
get_onkeypress   put_onmouseout   get_onmouseout  
put_onmouseover   get_onmouseover   put_onmousemove  
get_onmousemove   put_onmousedown   get_onmousedown  
put_onmouseup   get_onmouseup   get_document  
put_title   get_title   put_language  
get_language   put_onselectstart   get_onselectstart  
scrollIntoView   contains   get_sourceIndex  
get_recordNumber   put_lang   get_lang  
get_offsetLeft   get_offsetTop   get_offsetWidth  
get_offsetHeight   get_offsetParent   put_innerHTML  
get_innerHTML   put_innerText   get_innerText  
put_outerHTML   get_outerHTML   put_outerText  
get_outerText   insertAdjacentHTML   insertAdjacentText  
get_parentTextEdit   get_isTextEdit   click  
get_filters   put_ondragstart   get_ondragstart  
toString   put_onbeforeupdate   get_onbeforeupdate  
put_onafterupdate   get_onafterupdate   put_onerrorupdate  
get_onerrorupdate   put_onrowexit   get_onrowexit  
put_onrowenter   get_onrowenter   put_ondatasetchanged  
get_ondatasetchanged   put_ondataavailable   get_ondataavailable  
put_ondatasetcomplete   get_ondatasetcomplete   put_onfilterchange  
get_onfilterchange   get_children   get_all  

IHTMLElement::setAttribute

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.

strAttributeName
String specifying the name of the attribute to set.
AttributeValue
VARIANT structure containing a string, number, or Boolean value to assign to the attribute.
fCaseSensitive
Boolean value specifying whether to use a case-sensitive search to locate the attribute. If TRUE, the uppercase and lowercase letters in strAttributeName must match exactly those in the attribute name.

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

IHTMLElement::getAttribute

HRESULT getAttribute(
    BSTR strAttributeName, 
    LONG fFlags,
    VARIANT *AttributeValue
);

Retrieves the value of the given attribute.

strAttributeName
String specifying the name of the attribute to retrieve.
fFlags
Long integer value that contains the flags for this method.
AttributeValue
Address of a VARIANT structure that receives a string, number, or Boolean value as defined by the attribute. If the attribute is not present, this method returns NULL.

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

IHTMLElement::removeAttribute

HRESULT removeAttribute(
    BSTR strAttributeName,
    VARIANT_BOOL fCaseSensitive,
    VARIANT_BOOL *pfSuccess
);

Removes the given attribute from the element.

strAttributeName
String specifying the name of the attribute to remove.
fCaseSensitive
Boolean value specifying whether to use a case-sensitive search to locate the attribute. If TRUE, the uppercase and lowercase letters in strAttributeName must match exactly those in the attribute name.
pfSuccess
Address of a variable that receives TRUE if the function succeeds, or FALSE otherwise.

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.

IHTMLElement::put_className

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.

v
String specifying the value of the attribute. Can be any valid string.

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

IHTMLElement::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.

p
Address of a string variable that receives the value of the property, which can be any valid string.

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

IHTMLElement::put_id

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.

v
String containing the ID. For scripting, this can be any alphanumeric string that begins with a letter, and can include the underbar (_) character.

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

IHTMLElement::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.

p
Address of a string variable that receives the value of the id property. For scripting, this can be any alphanumeric string that begins with a letter, and can include the underbar (_) character.

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

IHTMLElement::get_tagName

HRESULT get_tagName(
    BSTR *p
);

Retrieves the name of the current object.

p
Address of a string variable that receives the name.

IHTMLElement::get_parentElement

HRESULT get_parentElement(
    IHTMLElement **p
);

Retrieves an interface pointer that provides access to the parent object's properties and methods.

p
Address of a pointer to the IHTMLElement interface of the parent object. The variable receives NULL if the current object is the top-most object.

IHTMLElement::get_style

HRESULT get_style(
    IHTMLStyle **p
);

Retrieves an inline style sheet for the tag.

p
Address of a pointer to the IHTMLStyle interface for the style sheet.

IHTMLElement::put_onhelp

HRESULT put_onhelp(
    VARIANT v
);

Sets the inline script associated with the onhelp event on the object.

v
VARIANT structure containing the inline script.

See also get_onhelp

IHTMLElement::get_onhelp

HRESULT get_onhelp(
    VARIANT *p);

Retrieves the inline script associated with the onhelp event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onhelp

IHTMLElement::put_onclick

HRESULT put_onclick(
    VARIANT v
);

Sets the inline script associated with the onclick event on the object.

v
VARIANT structure that contains the inline script.

See also get_onclick

IHTMLElement::get_onclick

HRESULT get_onclick(
    VARIANT *p
);

Retrieves the inline script associated with the onclick event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onclick

IHTMLElement::put_ondblclick

HRESULT put_ondblclick(
    VARIANT v
);

Sets the inline script associated with the ondblclick event on the object.

v
VARIANT structure that contains the script.

See also get_ondblclick

IHTMLElement::get_ondblclick

HRESULT get_ondblclick(
    VARIANT *p
);

Retrieves the inline script associated with the ondblclick event on the object.

p
Address of a VARIANT structure to store the script.

See also put_ondblclick

IHTMLElement::put_onkeydown

HRESULT put_onkeydown(
    VARIANT v
);

Sets the inline script associated with the onkeydown event on the object.

v
VARIANT structure that contains the script to set.

See also get_onkeydown

IHTMLElement::get_onkeydown

HRESULT get_onkeydown(
    VARIANT *p
);

Retrieves the inline script associated with the onkeydown event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onkeydown

IHTMLElement::put_onkeyup

HRESULT put_onkeyup(
    VARIANT v
);

Sets the inline script associated with the onkeyup event on the object.

v
VARIANT structure that contains the script to set.

See also get_onkeyup

IHTMLElement::get_onkeyup

HRESULT get_onkeyup(
    VARIANT *p
);

Retrieves the inline script associated with the onkeyup event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onkeyup

IHTMLElement::put_onkeypress

HRESULT put_onkeypress(
    VARIANT v
);

Sets the inline script associated with the onkeypress event on the object.

v
VARIANT structure that contains the script to set.

See also get_onkeypress

IHTMLElement::get_onkeypress

HRESULT get_onkeypress(
    VARIANT *p
);

Retrieves the inline script associated with the onkeypress event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onkeypress

IHTMLElement::put_onmouseout

HRESULT put_onmouseout(
    VARIANT v
);

Sets the inline script associated with the onmouseout event on the object.

v
VARIANT structure that contains the script to set.

See also get_onmouseout

IHTMLElement::get_onmouseout

HRESULT get_onmouseout(
    VARIANT *p
);

Retrieves the inline script associated with the onmouseout event on the object.

p
Address of a VARIANT structure to store the script in.

See also put_onmouseout

IHTMLElement::put_onmouseover

HRESULT put_onmouseover(
    VARIANT v
);

Sets the inline script associated with the onmouseover event on the object.

v
VARIANT structure that contains the script to set.

See also get_onmouseover

IHTMLElement::get_onmouseover

HRESULT get_onmouseover(
    VARIANT *p
);

Retrieves the inline script associated with the onkeyup event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onmouseover

IHTMLElement::put_onmousemove

HRESULT put_onmousemove(
    VARIANT v
);

Sets the inline script associated with the onmousemove event on the object.

v
VARIANT structure that contains the script to set.

See also get_onmousemove

IHTMLElement::get_onmousemove

HRESULT get_onmousemove(
    VARIANT *p
);

Retrieves the inline script associated with the onmousemove event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onmousemove

IHTMLElement::put_onmousedown

HRESULT put_onmousedown(
    VARIANT v
);

Sets the inline script associated with the onmousedown event on the object.

v
VARIANT structure that contains the script to set.

See also get_onmousedown

IHTMLElement::get_onmousedown

HRESULT get_onmousedown(
    VARIANT *p
);

Retrieves the inline script associated with the onmousedown event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onmousedown

IHTMLElement::put_onmouseup

HRESULT put_onmouseup(
    VARIANT v
);

Sets the inline script associated with the onmouseup event on the object.

v
VARIANT structure that contains the script to set.

See also get_onmouseup

IHTMLElement::get_onmouseup

HRESULT get_onmouseup(
    VARIANT *p
);

Retrieves the inline script associated with the onmouseup event on the object.

p
Address of a VARIANT structure to store the script.

See also put_onmouseup

IHTMLElement::get_document

HRESULT get_document(
    IDispatch **p
);

Retrieves an interface pointer that provides access to the document object's properties and methods.

p
Address of a pointer to the IDispatch interface for the document object. The variable receives NULL if the current object is the top-most object.

See also IHTMLDocument2

IHTMLElement::put_title

HRESULT put_title(
    BSTR v
);

Sets the title of the style sheet.

v
String specifying the title. It is FALSE for style sheets that do not specify a title, and that title is not currently selected.

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.