EN
本內容沒有您的語言版本,但有英文版本。

dblclick | ondblclick event

Fires when the user double-clicks the object.

Note  Starting with Internet Explorer 11, this event fires a MSPointerEvent object instead of a MouseEvent. You can use the MouseEvent.pointerType property to determine the type of contact that the click originated from (touch, mouse, or pen).

HTML 4.01 Specification, Section 18.2.3

 

Syntax

HTML Attribute <element ondblclick = "handler(event)">
Event Property object.ondblclick = handler;
attachEvent Method object.attachEvent("ondblclick", handler)
addEventListener Method object.addEventListener("dblclick", handler, useCapture)

 

Event information

SynchronousNo
BubblesYes
CancelableYes

 

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

Remarks

The order of events leading to the ondblclick event is onmousedown, onmouseup, onclick, onmouseup, and then ondblclick. Actions associated with any of these events are executed when the ondblclick event fires.

Initiates any action that is associated with the event.

To invoke this event, do one of the following:

  • Click the left mouse button twice in rapid succession over an object. The user's double-click must occur within the time limit specified by the user's system.

Examples

This example uses the ondblclick event to add items to a list box when the user double-clicks in the text box.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/ondblclickEX.htm



<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function addItem()
{
sNewItem = new Option(txtEnter.value)
selList.add(sNewItem);
}
</script>
</head>
<body>
<p>Enter text and then double-click in the text box to
   add text to the list box.</p>
<input type="text" name="txtEnter" value="Enter_text" 
   ondblclick="addItem()"><br><br>
<select name="selList" size="5"></select>
</body>
</html>

See also

a
address
applet
area
b
bdo
big
blockQuote
body
button
caption
center
cite
code
custom
dd
dfn
dir
div
dl
document
dt
em
embed
fieldSet
font
form
hn
hr
i
img
input type=button
input type=checkbox
input type=email
input type=file
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
kbd
label
legend
li
listing
map
marquee
menu
nextID
noBR
object
ol
p
plainText
pre
rt
ruby
s
samp
select
small
span
strike
strong
sub
sup
SVGSVGElement
table
tBody
td
textArea
tFoot
th
tHead
tr
tt
u
ul
var
window
xmp

 

 

顯示:
© 2014 Microsoft