This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

mousedown

Summary

Fires when the user clicks the object with either mouse button or taps the mouse pad.

Overview Table

Synchronous No
Bubbles Yes
Target dom/Element
Cancelable Yes
Default action ?
## Examples

This example shows how to determine the origin of the onmousedown event when event bubbling is used.

<body onmousedown="(event.target)?alert(event.target.tagName):alert(event.srcElement.tagName);">
<table style="table-layout:fixed; cell-collapse:collapse">
<tr>
  <th>Click the items below with your mouse.</th>
</tr>
  <tr><td><button type="button">Click Me</button></td></tr>
  <tr><td><input type="text" value="Click Me"/></td></tr>
  <tr><td>Click Me</td></tr>
</table>
<p>This code retrieves the tagName of the object on which
   the onmousedown event has fired.</p>
</body>

View live example

Usage

 Determine the properties of the DOM element that a user clicks on.

Notes

Remarks

Use the button property to determine which mouse button is clicked. Initiates actions associated with the event and with the object being clicked. To invoke this event, do one of the following:

  • Click a mouse button.

Syntax

Standards information

Event handler parameters

pEvtObj [in]
Type: ****IHTMLEventObj****

Attributions