-
Form Keypress Event
I have a web page form that I want to validate.
How can I capture the Ascii code for the onKeyPress event of a web page textbox?
Such as (VB Code):
Code:
Private Sub txtFileNum_KeyPress(KeyAscii As Integer)
If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub
Thanks in advance.
-
All I want to do is capture what key is being press in a textbox.
I would appreciate any help?:rolleyes:
-
Does this help you?
<HEAD>
<SCRIPT>
</SCRIPT>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function text1_onkeypress() {
alert( window.event.keyCode);
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<form name=form1>
<input type=text name=text1 LANGUAGE=javascript onkeypress="return text1_onkeypress()">
</form>
</BODY>
-
I was hoping for VBScript but that will work.
Thank you.
-
Pretty much the same:
Code:
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=VBScript>
Sub text1_onkeypress
window.alert window.event.keyCode
End Sub
</SCRIPT>