XHTML » XHTML Core Tag » onmousedown


The onmousedown event 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 five mouse events are: onmousedown, onmousemove, onmouseout, onmouseover, and onmouseup.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>DevGuru XHTML onmousedown Tag Example</title>
<input type="button" onmousedown="JavaScript: alert( 'onmousedown event' )" value="Click Down With Mouse!" />
DevGuru XHTML onmousedown Tag Example

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.

Language(s): XHTML

See Also: