Returns or sets a Variant that represents the value associated with the onkeydown event. For example, the Variant can represent a macro or procedure call that executes when the event has occurred. Read/write.
expression.onkeydown
expression Required. An expression that returns a DispFPHTMLDocument object.
The following example, which appears embedded in the <head> section of an HTML document, displays a message to the user when the user presses a key down within the current <form> element containing the onkeydown="DisplayMessage" attribute in the current page.
<head>
<title>onkeydown Example</title>
<script id=clientEventHandlersVBS language=vbscript>
<!--
Sub DisplayMessage
'Displays message to user
MsgBox "This message is displayed when the user presses a key down within the <form> element in the current document."
End Sub
-->
</script>
</head>
The <form> section code below calls the DisplayMessage procedure located in the < head> section of the document. When the user presses a key down within the <form> element in the document, a message will be displayed.
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV"
S-Label-Fields="TRUE" --><p onkeydown="DisplayMessage">
<input type="text" name="T1" size="20"><input type="submit" value="Submit"
name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
The following line of code sets the onkeydown attribute to the DisplayMessage procedure call. The index value zero (0) denotes the <form> tag as the first <form> element in the current page and the first <form> element in the all collection.
ActiveDocument.body.all.tags("form").item(0).onkeydown = "Display Message"