views:

15

answers:

1

Hi..

i need to know how to create own event handler occurs when we recieve message from keyboard or the button was pressed and then we write output in a textbox...

A: 

Here is some sample code to do it in Javascript.

 function AlertOnKeyPress(e) {
    var code;
    if (!e) var e = window.event;
    if (e.keyCode) code = e.keyCode;
    else if (e.which) code = e.which;
    var character = String.fromCharCode(code);
    alert('Character was ' + character);
}
CodeToGlory