EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

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
address
area
audio
b
bdo
blockQuote
body
button
canvas
caption
cite
code
custom
dd
del
dfn
div
dl
document
dt
em
embed
fieldSet
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
map
menu
object
ol
p
pre
q
rt
ruby
s
samp
select
small
source
span
strong
sub
sup
SVGSVGElement
table
tBody
td
textArea
tFoot
th
tHead
tr
u
ul
var
video
window
Reference
onmousewheel
onmousemove
onmouseout
onmouseover
onmouseup
onmspointerdown

 

 

Mostrar:
© 2014 Microsoft