aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/globaleventhandlers/ontouchstart/index.html
blob: 5e5cc65fad8a6618c5b1228cd4ca030e2170a1fa (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
71
72
73
74
---
title: GlobalEventHandlers.ontouchstart
slug: Web/API/GlobalEventHandlers/ontouchstart
translation_of: Web/API/GlobalEventHandlers/ontouchstart
---
<div>{{ApiRef("HTML DOM")}}</div>

<p>Un {{domxref("GlobalEventHandlers","global event handler")}} para el evento {{event("touchstart")}}.</p>

<p>{{SeeCompatTable}}</p>

<div class="note">
<p><strong>Nota:</strong> Este atributo <em>no</em> ha sido estandarizado formalmente. Está especificado en la especificación {{SpecName('Touch Events 2')}} {{Spec2('Touch Events 2')}} y no en {{SpecName('Touch Events')}} {{Spec2('Touch Events')}}. Este atributo no está totalmente implementado.</p>
</div>

<h2 id="Syntax" name="Syntax">Sintaxis</h2>

<pre class="eval">var startHandler = cualquierElemento.ontouchstart;
</pre>

<h3 id="Return_Value" name="Return_Value">Valor devuelto</h3>

<dl>
 <dt><code>startHandler</code></dt>
 <dd>El manejador del evento <code>touchstart</code> para el elemento <code>cualquierElemento</code>.</dd>
</dl>

<h2 id="Ejemplo">Ejemplo</h2>

<p>Este ejemplo muestra dos formas de utilizar <code>ontouchstart</code> para establecer un manejador de evento <code>touchstart</code>.</p>

<pre class="brush: js">&lt;html&gt;
&lt;script&gt;
function startTouch(ev) {
 // Procesar el evento
}
function init() {
 var el=document.getElementById("target1");
 el.ontouchstart = startTouch;
}
&lt;/script&gt;
&lt;body onload="init();"&gt;
&lt;div id="target1"&gt; Tócame ... &lt;/div&gt;
&lt;div id="target2" ontouchstart="startTouch(event)"&gt; Tócame ... &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Especificación</th>
   <th scope="col">Estado</th>
   <th scope="col">Comentario</th>
  </tr>
  <tr>
   <td>{{SpecName('Touch Events 2','#widl-GlobalEventHandlers-ontouchstart')}}</td>
   <td>{{Spec2('Touch Events 2')}}</td>
   <td>Versión no estable.</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidad_en_navegadores">Compatibilidad en navegadores</h2>

{{Compat("api.GlobalEventHandlers.ontouchstart")}}

<h2 id="Ver_también">Ver también</h2>

<ul>
 <li>{{ event("touchstart") }}</li>
</ul>