直接看代码来得快:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <button id="hhhh">按住说话</button> <style type="text/css"> #hhhh{height:40px;line-height: 40px; text-align: center; background: #f00; color:#fff;} </style> <script> document.getElementById('hhhh').addEventListener('touchstart', function(ev) { ev.preventDefault(); this.style.background = '#f00'; //your start record code here... }, false); document.getElementById('hhhh').addEventListener('touchend', function(ev) { ev.preventDefault(); this.style.background = '#0f0'; //your stop record code here... }, false); </script>
原文地址:http://blog.csdn.net/wujiangwei567/article/details/45696441