add method

[This documentation is preliminary and is subject to change.]

Adds an element to the areas, controlRange, or options collection.

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5

Syntax

HRESULT retVal = object.add(element, before);

Standards information

Parameters

  • element [in]
    Type: IHTMLElement

    Pointer to an IHTMLElement interface that specifies the element to add to the collection.

  • before [in, optional]
    Type: VARIANT

    VARIANT of type VT_I4 that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.

    Internet Explorer 8 and later. VARIANT of type VT_DISPATCH that specifies an element to insert before, or NULL to append the object to the collection.

Return value

Type: HRESULT

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

Remarks

This method adds an OPTION element to a SELECT block.

Before you can add an element to a collection, you must create it first by using the createElement method.

See also

add

remove

 

 

Build date: 1/26/2012