HTML Mouse and Keyboard Event Handler Attributess


HTML Mouse and Keyboard event handlers are those that triggered by changes of mouse movement and keyboard inputs.

For example, the following event handler "onclick" will show an alert window when the button is clicked.

<input type=button value="Test" onclick="alert('test');">


Attribute list of keyboard events:
Attribute NamesEvents
onkeydownWhen key is pressed
onkeypressWhen key is pressed and released
onkeyupWhen key is released

Attribute list of mouse events:
Attribute NamesEvents
onclickWhen mouse clicks
ondbclickWhen mouse double clicks
ondragDrag using mouse, HTML5 only
ondragendMouse drag ends, HTML5 only
ondragenterWhen element is dragged into a target, HTML5 only
ondragleaveWhen element is dragged away, HTML5 only
ondragoverWhen element is dragged over a target, HTML5 only
ondragstartWhen drag starts, HTML5 only
ondropWhen dragged element is dropped, HTML5 only
onmousedownWhen mouse button is pressed
onmousemoveWhen mouse is moving
onmouseoutWhen the mouse pointer leaves an object
onmouseoverWhen the mouse pointer is above an object
onmouseupWhen mouse button released
onmousewheelWhen mouse wheel is moving
onscrollWhen the scrollbar of a box is moving