toElement Property

Microsoft FrontPage Visual Basic

toElement Property

Returns an IHTMLElement object that represents the element to which the user is moving the mouse pointer during an onmouseover or onmouseout event.

expression.toElement

expression    Required. An expression that returns an IHTMLEventObj object.

Remarks

See also the fromElement and srcElement properties

Example

The following example follows the mouse pointer and selects the element over which the mouse pointer is positioned. 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 Sub objDoc_onmouseover()
    Dim objEvent As IHTMLEventObj
    Dim objRange As IHTMLTxtRange
    Dim objElement As IHTMLElement

    Set objEvent = objWindow.event
    Set objElement = objEvent.toElement
    Set objRange = objDoc.body.createTextRange
    
    objRange.moveToElementText objElement
    objRange.Select

End Sub