這段代碼第一次執(zhí)行的時候正常,但第二次就無效,求解var cir = document.getElementsByClassName("circle")[0];cir.onmousedown = function( event ){ var disX = event.clientX - cir.offsetLeft; var disY = event.clientY - cir.offsetTop; document.onmousemove = function( event ){ cir.style.left = ( event.clientX - disX ) + "px"; cir.style.top = ( event.clientY - disY ) + "px"; return false; } } document.onmouseup = function(){ cir.onmousedown = null; document.onmousemove = null; }
鼠標移動事件,第二次無效,求解
幕布斯7119047
2018-09-11 13:14:36