elements Property

Microsoft FrontPage Visual Basic

elements Property

Returns an IHTMLElementCollection object that represents a collection of elements contained in a form.

expression.elements

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

The following example inserts an id attribute for each of the elements contained in the first form in the active document.

    Sub SetIDForFormElements()
    Dim objForm As FPHTMLFormElement
    Dim objElement As IHTMLElement
    Dim intElement As Integer
    
    Set objForm = ActiveDocument.forms.Item(0)
    
    For Each objElement In objForm.elements
        intElement = intElement + 1
        objElement.Id = "FormElement" & intElement
    Next objElement
End Sub