onmousemove event
onmouseout event
onmouseover event
onmouseup event
EVENT: onmousedown
onmousedown="action"
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
.
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:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<title>DevGuru XHTML onmousedown Tag Example</title>
</head>
<body>
<input type="button"
onmousedown="JavaScript
:
alert( 'onmousedown event' )"
value="Click Down With Mouse!" />
</body>
</html>
Output:
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information