HTML onmousedownEvent Attributes
Examples
Run the script when the mouse button is pressed:
<p onmousedown="mouseDown()">Click the text!</p>
Try it yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the onmousedown event attribute
Definition and Usage
The onmousedown attribute fires when the mouse button is pressed.
Tip:The order of events related to the onmousedown event (left/middle mouse button):
- onmousedown
- onmouseup
- onclick
The order of events related to the onmousedown event (right mouse button):
- onmousedown
- onmouseup
- oncontextmenu
Note:The onmousedown attribute cannot be used on 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 Values
| Value | Description |
|---|---|
| script | Specifies the script to be executed when the onmousedown event is triggered. |
HTML Event Attributes Other Extensions