JS keyboard events are those associated with some keyboard activity by user. The most commonly used are :-
- OnKeydown Event -Event occurs, as soon as key is pressed. Like alphabet written in text box.
- OnKeyup Event - Event occurs, just as the pressed key is released.
- OnKeypress Event - A combination of Onkeydown and Onkeyup event handlers.
These event handler is used to instruct the browser on What action to take when a keyboard key is pressed or released. Generally used with text fields in forms.
As we studied in previos lessons, the events are commonly used in combination with functions.
Onkeydown and OnkeyUp Example
As you will write a letter in the text box below, a message will be displayed "User is currently typing". Then once you release the button, the text character will be converted to upper case.
only numbers allowed.
http://www.w3schools.com/jsref/event_onkeyup.asp
http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml
No comments:
Post a Comment