srcElement Property

Microsoft FrontPage Visual Basic

srcElement Property

Returns an IHTMLElement that represents the element that raised an event.

expression.srcElement

expression    Required. An expression that returns an IHTMLEventObj object.

Remarks

See also the fromElement and toElement properties.

Example

The following example changes the background color of the element that the users clicks. This example must be placed in a class module, and it assumes that you have declared in the General Declarations section of a class module an FPHTMLDocument object variable called "objDoc" using the WithEvents keyword.

    Private Function objDoc_onclick() As Boolean

    Dim objEvent As IHTMLEventObj
    Dim objElement As IHTMLElement
    
    Set objEvent = objWindow.event
    Set objElement = objEvent.srcElement
    
    objElement.Style.backgroundColor = "aqua"

End Function