JavaScript Tutorial

Define JavaScript

JS Arithmetic Exercise

JavaScript Comment

JavaScript Variable

JavaScript Operators

Conditional Statements

Logical Operators

JavaScript Slider

JS Login Form

JS Popup Boxes

JavaScript Loops

JavaScript Arrays

JS Mouse Events

JS Keyboard Events

Styling Elements

External JavaScript

JS Noscript Tag

JS String Functions

JS Math Functions

JS Date Functions

JS Theme Changer

JS Assignment

Page Stats

Visitor: 111

JavaScript Keyboard Events

EventDecription
onkeydownThe onkeydown event occurs when the user pressed a key down from the keyboard. DOM Ver 2
onkeypressThe onkeypress event occurs when the user presses a key from the keyboard. DOM Ver 2
onkeyupThe onkeyup event occurs when the user releases a key from the keyboard. DOM Ver 2

JavaScript onkeydown event

Example 1: JavaScript onkeydown event.

JavaScript onkeydown event

Example 2: JavaScript onkeyup event.

Example 3: JavaScript onkeyup event.

Example 4: JavaScript onkeyup event.

Example 5: JavaScript onfocus, onblur event.

Example 6: Change document backcolor using HTML select element. Output: