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 Names | Events |
onkeydown | When key is pressed |
onkeypress | When key is pressed and released |
onkeyup | When key is released |
Attribute list of mouse events:
Attribute Names | Events |
onclick | When mouse clicks |
ondbclick | When mouse double clicks |
ondrag | Drag using mouse, HTML5 only |
ondragend | Mouse drag ends, HTML5 only |
ondragenter | When element is dragged into a target, HTML5 only |
ondragleave | When element is dragged away, HTML5 only |
ondragover | When element is dragged over a target, HTML5 only |
ondragstart | When drag starts, HTML5 only |
ondrop | When dragged element is dropped, HTML5 only |
onmousedown | When mouse button is pressed |
onmousemove | When mouse is moving |
onmouseout | When the mouse pointer leaves an object |
onmouseover | When the mouse pointer is above an object |
onmouseup | When mouse button released |
onmousewheel | When mouse wheel is moving |
onscroll | When the scrollbar of a box is moving |