zoukankan      html  css  js  c++  java
  • Html Div 拖拽

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css">#main div{position:absolute;width:220px;height:150px;border:1px solid #999;}</style><script type="text/javascript">var a;document.onmouseup=function(){if(!a)return;document.all?a.releaseCapture():window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);a="";};document.onmousemove=function (d){if(!a)return;if(!d)d=event;a.style.left=(d.clientX-b)+"px";a.style.top=(d.clientY-c)+"px";};function $(o,e){a=o;document.all?a.setCapture():window.captureEvents(Event.MOUSEMOVE);b=e.clientX-parseInt(a.style.left);c=e.clientY-parseInt(a.style.top);}</script></head><body>  <div id="main">    <div style="left:100px;top:100px;background:#fc9;" onmousedown="$(this,event)">1</div>    <div style="left:400px;top:100px;background:#9cf;" onmousedown="$(this,event)">2</div>    <div style="left:700px;top:100px;background:#f9c;" onmousedown="$(this,event)">3</div>    <div style="left:100px;top:300px;background:#9fc;" onmousedown="$(this,event)">4</div>    <div style="left:400px;top:300px;background:#c9f;" onmousedown="$(this,event)">5</div>    <div style="left:700px;top:300px;background:#cf9;" onmousedown="$(this,event)">6</div>  </div></body></html>
  • 相关阅读:
    [网络基础 ] 分层体系结构
    网络的基础知识
    计算机网络基础知识总结
    理解urllib、urllib2及requests区别及运用
    js ajax请求
    c# winform导出Excel
    mysql小技巧
    “允许源文件与模块生成文件不同” 解决方法 ,亲测最有效的
    ThoughtWorks.QRCode生成二维码
    python3.5.2爬虫
  • 原文地址:https://www.cnblogs.com/gaobing/p/3840120.html
Copyright © 2011-2022 走看看