HTML onmousedown event attribute
Example
Execute a JavaScript when the mouse button is pressed on a paragraph:
<p onmousedown="mouseDown()"Klik på denne tekst!
Browser supports
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 down on the element.
Tip:Event order relative to onmousedown event (limited to left/middle mouse button):
- onmousedown
- onmouseup
- onclick
Event order relative to onmousedown event (limited to right mouse button):
- onmousedown
- onmouseup
- 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. |