Wednesday, August 01, 2007

DOM Event Types

Mouse events

The mouse events that are most commonly handled in a web application are

mouseup,
mousedown,
click,
dblclick,
mousemove


Keyboard events

The commonly handled keyboard events are

keyup,
keydown,
blur,
focus.


Change event

change


Page events

window.onload
window.onunload
window.onbeforeunload

Example:

<script type="text/javascript">
window.onload = function() {
alert('Loaded!');
window.onunload = function() {
alert('Unloaded!');
}
window.onbeforeunload =
function() {
return 'Leaving so soon?';
}
}
}
</script>