| 12345678910111213141516171819202122232425262728293031323334353637 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
- <head>
 
-     <meta charset="UTF-8">
 
-     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
-     <title>Document</title>
 
-     <style>
 
-         #box {
 
-             width: 200px;
 
-             height: 200px;
 
-             background: #0f0;
 
-             position: absolute;
 
-         }
 
-     </style>
 
- </head>
 
- <body>
 
-     <div id="box"></div>
 
-     <script>
 
-         // clientX 鼠标在客户端的X轴位置
 
-         // clientY 鼠标在客户端的Y轴位置
 
-         var box = document.getElementById("box");
 
-         box.onmousedown = function(event) {
 
-             console.log(event)
 
-             // box.style.left = 330 + 'px';
 
-             var left1 = event.clientX - box.offsetLeft;
 
-             var top1 =  event.clientY - box.offsetTop;
 
-             box.onmousemove = function(event) {
 
-                 box.style.left =  event.clientX - left1 + 'px';
 
-                 box.style.top =  event.clientY - top1 + 'px';
 
-             }
 
-         }
 
-         box.onmouseup = function() {
 
-             box.onmousemove = null;
 
-         }
 
-     </script>
 
- </body>
 
- </html>
 
 
  |