HTML onmousedown Event Attribute
Example
Execute a JavaScript when the mouse button is pressed on a paragraph:
<p onmousedown="mouseDown()"!Please click on this text!</p>
Browser Support
IE | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
All major browsers support the onmousedown attribute.
Definition and Usage
The onmousedown attribute is triggered when the mouse button is pressed down on the element.
Tip:Event sequence relative to the onmousedown event (limited to left/middle mouse button):
- onmousedown
- onmouseup
- onclick
Event sequence relative to the 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 the onmousedown event occurs. |