--- title: GlobalEventHandlers.ontouchmove slug: Web/API/GlobalEventHandlers/ontouchmove translation_of: Web/API/GlobalEventHandlers/ontouchmove ---
A {{domxref("GlobalEventHandlers","global event handler")}} for the {{event("touchmove")}} event.
{{SeeCompatTable}}
Note: 这个属性没有正式标准化。它在 {{SpecName('Touch Events 2')}} {{Spec2('Touch Events 2')}} 规范中提出,而不在 {{SpecName('Touch Events')}} {{Spec2('Touch Events')}} 中. 这个属性没有被广泛地实现.
var moveHandler = someElement.ontouchmove;
moveHandler
someElement
元素的 touchmove 事件处理句柄/函数。这个例子展示了两种通过 ontouchmove 设置元素的 touchmove 事件处理句柄/函数的方式。
<html> <script> function moveTouch(ev) { // 书剑 } function init() { var el=document.getElementById("target1"); el.ontouchmove = moveTouch; } <body onload="init();"> <div id="target1"> Touch me ... </div> <div id="target2" ontouchmove="moveTouch(event)"> Touch me ... </div> </body> </html>
Specification | Status | Comment |
---|---|---|
{{SpecName('Touch Events 2','#widl-GlobalEventHandlers-ontouchmove')}} | {{Spec2('Touch Events 2')}} | Non-stable version. |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatChrome(18.0)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |