With
the alert box displays the value in the box, not included the current key dep
Passing 'value' as a parameter is generally verbotim - its a reserved word. Your 'this' refers to the input field, and so 'this.value' returns the entire content of the input field. To get the keyCode from the keypress event try:
This doesn't work with:
onKeyPress="event.charCode;"
or:
onKeyPress="this.event.charCode;"
because no event object is created.