原理: 当oDiv2移动时,将ev.clientX-差值+oDiv2的宽度赋给oDiv.style.left <style> #div1{ width:200px; height:200px; background-color: red; position:rela