Find out how many fingers that touches the surface.
Touch events works for touch devices only.
<!DOCTYPE html> <html> <meta name="viewport" content="width=device-width, initial-scale=1"> <body ontouchstart="countTouches(event)" ontouchend="countTouches(event)"> <p>Touch somewhere in this document.</p> <p>The number of fingers touching this document is currently <span id="demo">0</span>.</p> <script> function countTouches(event) {/*from w w w. j a v a 2s . c o m*/ var x = event.touches.length; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The touches property returns an array of Touch objects, one for each finger touching the surface.
This property is read-only.