HTML event ondblclick

From Htmlpedia
Jump to: navigation, search

Event Attribute onDblClick

onDblClick is an event attribute, it takes JavaScript-code as a value. The code will be executed when:

  • The user double-clicks the mousebutton while hovering above the element, and then releases it while hovering above the element.
  • The element is focused and the Return key is pressed

Example

In this example, the user will receive a messagebox saying "You clicked on the text", after double-clicking anywhere on the text "Double-click me"

<a ondblclick="alert('You double-clicked on the text')">Double-click me</a>

Controversy

As this event requires the user to double-click, users with impaired motor skills may find this difficult. Also, if there is no notification about the double-click, users may single-click to no despair.

Related

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup