Latest web development tutorials

HTML onmousedown event properties

HTML Event Attributes HTML Event Attributes

Examples

Run the script when the mouse button is pressed:

<p onmousedown="mouseDown()">Click the text!</p>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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):

  1. onmousedown
  2. onmouseup
  3. onclick

Onmousedown events related to the event trigger sequence (right mouse button):

  1. onmousedown
  2. onmouseup
  3. 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 HTML Event Attributes