EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

mousedown | onmousedown event

Fires when the user clicks the object with either mouse button.

HTML 4.01 Specification, Section 18.2.3

Syntax

HTML Attribute <element onmousedown = "handler(event)">
Event Property object.onmousedown = handler;
addEventListener Method object.addEventListener("mousedown", handler, useCapture)

Event information

SynchronousNo
BubblesYes
CancelableYes

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

Remarks

Use the button property to determine which mouse button is clicked.

Initiates actions associated with the event and with the object being clicked.

To invoke this event, do one of the following:

  • Click a mouse button.

Examples

This example shows how to determine the origin of the onmousedown event when event bubbling is used.


<body onmousedown="console.log(event.srcElement.tagName)">
<table border=1>
  <th>Click the items below with your mouse.</th>
  <tr><td><button>Click Me</button></td></tr>
  <tr><td><input type="text" value="Click Me"></td></tr>
  <tr><td><span>Click Me</span></td></tr>
</table>
<p>This code retrieves the tagName of the object on which
   the onmousedown event has fired.</p>
</body>

See also

a
abbr
acronym
address
applet
area
audio
b
bdo
big
blockQuote
body
button
canvas
caption
center
cite
code
custom
dd
del
dfn
dir
div
dl
document
dt
em
embed
fieldSet
font
form
hn
hr
i
img
input type=button
input type=checkbox
input type=email
input type=file
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
kbd
label
legend
li
listing
map
marquee
menu
noBR
object
ol
p
plainText
pre
q
rt
ruby
s
samp
select
small
source
span
strike
strong
sub
sup
SVGSVGElement
table
tBody
td
textArea
tFoot
th
tHead
tr
tt
u
ul
var
video
window
xmp
Reference
onmousewheel
onmousemove
onmouseout
onmouseover
onmouseup
onmspointerdown

 

 

Afficher:
© 2014 Microsoft