onkeydown Event

Microsoft FrontPage Visual Basic

Show All Show All

onkeydown Event

Occurs when a users presses a key on the keyboard when a page is displayed in Design view in Microsoft FrontPage.

expression.onkeydown

expression    Required. An expression that returns one of the objects in the Applies To list, which has been declared using the WithEvents keyword in a class module.

Example

The following example sets the letterspacing attribute for the active element when the user presses the Ctrl-Alt-X key combination. 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 FPHTMLBody object variable called "objBody" using the WithEvents keyword.

    Private Sub objBody_onkeydown()
    Dim objEvent As IHTMLEventObj
    Dim objElement As IHTMLElement
    
    Set objEvent = objBody.Document.parentWindow.event
    
    If objEvent.ctrlKey = True And objEvent.altKey = True And _
            objEvent.keyCode = 88 Then
        objEvent.srcElement.Style.letterSpacing = "10px"
    End If
End Sub