blob: db9380a8bd50f845c33daf0a2102ea06cf263a47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
---
title: element.ondblclick
slug: Web/API/GlobalEventHandlers/ondblclick
tags:
- DOM
- DOM_0
- Référence_du_DOM_Gecko
translation_of: Web/API/GlobalEventHandlers/ondblclick
---
{{ ApiRef() }}
### Résumé
La propriété **ondblclick** renvoie le gestionnaire d'évènement `dblclick` de l'élément courant.
### Syntaxe
element.ondblclick = nomDeFonction;
- `nomDeFonction` est le nom d'une fonction définie par l'utilisateur, sans les parenthèses ni aucun paramètre. Il peut également s'agir d'une déclaration de fonction anonyme, comme :
<!---->
element.ondblclick = function() { alert("Évènement dblclick détecté"); };
### Exemple
```html
<html>
<head>
<title>ondblclick event example</title>
<script type="text/javascript">
function initElement() {
var p = document.getElementById("foo");
// Attention : showAlert(); ou showAlert(param); ne fonctionneront pas ici,
// il doit s'agir d'une référence à un nom de fonction, pas un appel de fonction.
p.ondblclick = showAlert;
};
function showAlert() {
alert("Évènement dblclick détecté")
}
</script>
<style type="text/css">
<!--
#foo {
border: solid blue 2px;
}
-->
</style>
</head>
<body onload="initElement()";>
<span id="foo">Mon élément</span>
<p>Double-cliquez sur l'élément ci-dessus.</p>
</body>
</html>
```
### Notes
L'évènement `dblclick` est déclenché lorsque l'utilisateur double-clique sur un élément.
### Spécification
{{ DOM0() }}
|