onmousemove attribute
onmouseout attribute
onmouseover attribute
onmouseup attribute
CORE ATTRIBUTE: onmousedown
onmousedown="action"
Available in versions: 4.0
HTML 4.0 tag compatibility: All tags except
applet, base, basefront, bdo, br, font, frame, frameset, head, html, iframe, isindex, meta, param, script, style, title
The
onmousedown
core attribute is an event handler that is associated with clicking down the mouse button while the mouse is inside a selected HTML tag (element). In other words, the mouse down event occurred while the HTML element was in focus. Every time you click down the mouse, while inside the element, the script code of the
onmousedown
is executed. This script can also call functions or subroutines which contain code that you want to run when this event occurs.
The four other similar core attributes are:
onmousemove, onmouseout, onmouseover,
and
onmouseup
.
In this example, place the mouse inside on the
button
element, click down, and hold it. Every time you click down, one line of JavaScript code is executed which causes an alert box to be displayed with a message. Finally, release the mouse and click okay in the alert.
Code:
<input type="button" onmousedown="JavaScript
:
alert( 'onmousedown event' )" value="Click Down With Mouse!">
Output:
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information