var maxX=-1; var maxY=-1; var minX =99999; var minY=99999; function checkData(event){ var x=event.pageX-$('canvas').offset().left; var y=event .pageY-$('canvas').offset().top; if(x>maxX){ maxX=x; }else if(xminX= x; } if(y>maxY){ maxY=y; }否則if(yminY=y; } } $(function(){ var obj=$('canvas'); var temp_e; var temp_draw=false;