Home Web Front-end HTML Tutorial html event attribute onmousedown triggered when the mouse button is pressed on the element

html event attribute onmousedown triggered when the mouse button is pressed on the element

Nov 06, 2017 am 11:00 AM
html element press

Example

Execute a paragraph when the mouse button is pressed on the paragraphJavaScript:

<p onmousedown="mouseDown()">请点击此文本!</p>
Copy after login

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 on the element.

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

onmousedown onmouseup onclick

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

onmousedown onmouseup oncontextmenu

Note: The onmousedown attribute does not apply to the following elements: , < ;bdo>,
, , ,