HTML onmousedown event properties
Examples
Run the script when the mouse button is pressed:
<p onmousedown="mouseDown()">Click the text!</p>
try it"
Browser Support
All major browsers support onmousedown event attributes
Definition and Usage
onmousedown attribute triggered when the mouse button is pressed.
Tip: onmousedown events related to the event trigger sequence (left / middle mouse button):
- onmousedown
- onmouseup
- onclick
Onmousedown events related to the event trigger sequence (right mouse button):
- onmousedown
- onmouseup
- oncontextmenu
Note: onmousedown attribute can not 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
no.
grammar
<elementonmousedown=" script ">
Property Value
值 | 描述 |
---|---|
script | 规定该onmousedown事件触发时执行的脚本。 |
HTML Event Attributes