Share via


onclick Event

Occurs when a user clicks on a page or an element within a page in Design view in Microsoft FrontPage.

expression.onclick

*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 selects the active element when the user clicks on the document. 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 objRange As IHTMLTxtRange
    Dim objElement As IHTMLElement
    Dim objEvent As IHTMLEventObj
    
    Set objEvent = objDoc.parentWindow.event
    Set objElement = objEvent.srcElement
    Set objRange = ActiveDocument.body.createTextRange

    objRange.moveToElementText objElement
    objRange.Select
End Function

Applies to | FPHTMLAnchorElement Object | FPHTMLAreaElement Object | FPHTMLBaseFontElement Object | FPHTMLBlockElement Object | FPHTMLBody Object | FPHTMLBRElement Object | FPHTMLButtonElement Object | FPHTMLDDElement Object | FPHTMLDivElement Object | FPHTMLDivPosition Object | FPHTMLDListElement Object | FPHTMLDocument Object | FPHTMLDTElement Object | FPHTMLEmbed Object | FPHTMLFieldSetElement Object | FPHTMLFontElement Object | FPHTMLFormElement Object | FPHTMLFrameBase Object | FPHTMLFrameElement Object | FPHTMLFrameSetSite Object | FPHTMLFrontPageBotElement Object | FPHTMLHeaderElement Object | FPHTMLHRElement Object | FPHTMLIFrame Object | FPHTMLImg Object | FPHTMLInputButtonElement Object | FPHTMLInputFileElement Object | FPHTMLInputImage Object | FPHTMLInputTextElement Object | FPHTMLLabelElement Object | FPHTMLLegendElement Object | FPHTMLLIElement Object | FPHTMLLinkElement Object | FPHTMLListElement Object | FPHTMLMapElement Object | FPHTMLMarqueeElement Object | FPHTMLOListElement Object | FPHTMLOptionElement Object | FPHTMLParaElement Object | FPHTMLPhraseElement Object | FPHTMLScriptElement Object | FPHTMLSelectElement Object | FPHTMLSpanElement Object | FPHTMLSpanFlow Object | FPHTMLStyleElement Object | FPHTMLTable Object | FPHTMLTableCaption Object | FPHTMLTableCell Object | FPHTMLTableCol Object | FPHTMLTableRow Object | FPHTMLTableSection Object | FPHTMLTemplateRegionElement Object | FPHTMLTextAreaElement Object | FPHTMLTextElement Object | FPHTMLUListElement Object | FPHTMLUnknownElement Object | FPHTMLWebPartElement Object | FPHTMLWebPartZoneElement Object | FPHTMLXSLElement Object | FPHTMLXSLWebPartElement Object