accessKey Property
Sets or returns a String that represents the shortcut key, also known as the accelerator key, for a specified object.
expression.accessKey
*expression * Required. An expression that returns one of the objects in the Applies To list.
Remarks
Setting the accessKey property for an object sets the value of the accessKey attribute for an element. When a page is viewed in a browser, a user can press the ALT key plus the value of the accessKey attribute to move to the element or, in some cases, to trigger an event associated with the element.
Example
The following example creates a new Web page, adds a form to it, and then adds text and an input text element to the form. Then it sets the accessKey attribute of the text box to the specified letter and underlines the letter, specified with the intKey argument, in the text associated with the text box.
Function CreateTextBox(objForm As FPHTMLFormElement, _
strName As String, intKey As Integer) As Boolean
Dim objName As FPHTMLInputTextElement
Dim strKey As String
Dim strID As String
If intKey <= Len(strName) Then
strID = strName
strKey = Trim(Mid(strName, intKey, 1))
strName = Trim(Replace(strName, strKey, "<U>" & _
Mid(strName, intKey, 1) & "</U>"))
objForm.insertAdjacentHTML "beforeend", strName & _
": <input id=" & strID & " size=""20"">"
Set objName = objForm.all.tags("input").Item(CVar(strID))
objName.accessKey = strKey
CreateTextBox = True
Else
CreateTextBox = False
End If
End Function
Use the following subroutine to call the preceding function.
Sub CallCreateTextBox()
Dim objForm As FPHTMLFormElement
ActiveDocument.body.insertAdjacentHTML "beforeend", _
"<form id=""newform""></form>"
Set objForm = ActiveDocument.all.tags("form").Item("newform")
Call CreateTextBox(objForm, "Address", 1)
End Sub
Applies to | FPHTMLAnchorElement Object | FPHTMLBody Object | FPHTMLButtonElement Object | FPHTMLDivPosition Object | FPHTMLEmbed Object | FPHTMLFieldSetElement Object | FPHTMLFrameBase Object | FPHTMLFrameElement Object | FPHTMLFrameSetSite Object | FPHTMLIFrame Object | FPHTMLImg Object | FPHTMLInputButtonElement Object | FPHTMLInputFileElement Object | FPHTMLInputHiddenElement Object | FPHTMLInputImage Object | FPHTMLInputTextElement Object | FPHTMLLabelElement Object | FPHTMLLegendElement Object | FPHTMLMarqueeElement Object | FPHTMLObjectElement Object | FPHTMLSelectElement Object | FPHTMLSpanFlow Object | FPHTMLTable Object | FPHTMLTableCaption Object | FPHTMLTableCell Object | FPHTMLTextAreaElement Object | IHTMLAnchorElement Object | IHTMLControlElement Object | IHTMLLabelElement Object