HTML onmousedown-eigenschap

Voorbeeld

Voer een stuk JavaScript uit wanneer de muisknop wordt ingedrukt op een paragraaf:

<p onmousedown="mouseDown()">Klik op deze tekst!</p>

Probeer het zelf

Browser ondersteunt

IE Firefox Chrome Safari Opera

All mainstream browsers support the onmousedown attribute.

Definition and usage

The onmousedown attribute triggers when the mouse button is pressed on the element.

Tip:Event order relative to onmousedown event (limited to left/middle mouse button):

  1. onmousedown
  2. onmouseup
  3. onclick

Event order relative to onmousedown event (limited to right mouse button):

  1. onmousedown
  2. onmouseup
  3. oncontextmenu

Note:The onmousedown attribute is not applicable to the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style> or <title>.

Differences between HTML 4.01 and HTML5

None.

Syntax

<element onmousedown="script">

Attribute value

Value Description
script Script executed when onmousedown occurs.