日期:2014-05-17 浏览次数:20765 次
 <!DOCTYPE HTML>
   <html>
   <head>
   <title>PhoneGap</title>
   <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
   <script type="text/javascript" src="jquery-1.5.1.js"></script>   
   </head>
   <body>
   <canvas id='simple' width='600px' height='600px'>浏览器不支持canvas</canvas>
           <script>
                var canvas=null,context=null;
                function resetCanvas(){
                canvas=document.getElementById('simple');
                context=canvas.getContext('2d');
                }
                $(document).ready(function(){
                resetCanvas();
                canvas.addEventListener('touchstart',function(evt){
                evt.preventDefault();
                context.beginPath();
                context.moveTo(evt.touches[0].pageX,evt.touches[0].pageY);
                },false);
                canvas.addEventListener('touchmove',function(evt){
                context.lineTo(evt.touches[0].pageX,evt.touches[0].pageY);
                context.stroke();
                },false);
                canvas.addEventListener('touchend',function(evt){
                },false);
                });
            </script>
 </body>
   </html>