Partager via


add method

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

 

Syntax

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

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.

Standards information

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 IHTMLDocument2::createElement method.

See also

IHTMLSelectElement::remove