鼠标事件 move&up $("#game").mousemove(function(e){ if(untangleGame.targetCircle !=undefined){ var mouseX=e.pageX-this.offsetLeft; var mouseY =e.pageY-this.offsetTop; var radius=untangleGame.circles[untangleGame.targetCircle].radius; untangleGame.circles[untangleGame.targetCircle] =new Circle(mouseX,mouseY,radius); connectCircles(); $(#game").mouseup(function(e){ untangleGame.targetCircle undefined;鼠标事件——move&up $("#game").mousemove(function(e) { if (untangleGame.targetCircle != undefined) { var mouseX = e.pageX-this.offsetLeft; var mouseY = e.pageY-this.offsetTop; var radius = untangleGame.circles[untangleGame.targetCircle].radius; untangleGame.circles[untangleGame.targetCircle] = new Circle(mouseX, mouseY, radius); connectCircles(); } }); $("#game").mouseup(function(e) { untangleGame.targetCircle = undefined; });