執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
轉到Spaces
<!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>