运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
转到空间
<!DOCTYPE html> <html> <body> <h1>DOM touchcancel Event</h1> <p id="myP">Touch this paragraph while you do something that will interrupt the event. Different devices will interrupt the touch at different actions, so this example can be difficult to demonstrate, but it is considered good practice to include this event.</p> <p><strong>Note:</strong> This example is for touch devices only.</p> <p id="demo"></p> <script> document.getElementById("myP").ontouchcancel = myFunction; function myFunction() { document.getElementById("demo").innerHTML = "Touch Cancelled"; } </script> </body> </html>