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

黄舟
Release: 2017-11-06 11:00:05
Original
4878 people have browsed it

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>,
, , ,