• 拖拽


    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="author" content="智能社 - zhinengshe.com" />
    <meta name="copyright" content="智能社 - zhinengshe.com" />
    <title>智能社 - www.zhinengshe.com</title>
    <style>
    #div1{ position:absolute;left:0;top:0;200px; height:200px; background:red;}
    </style>
    <script>

    window.onload = function(){

    var oDiv = document.getElementById("div1");
    var disX =0;
    var disY =0;
    oDiv.onmousedown=function(ev){
    var oEvent = ev || event;

    disX = oEvent.clientX -oDiv.offsetLeft;
    disY = oEvent.clientY -oDiv.offsetTop;

    document.onmousemove=function(ev){
    var oEvent = ev || event;
    oDiv.style.left = oEvent.clientX-disX+'px';
    oDiv.style.top= oEvent.clientY-disY+'px';
    }


    document.onmouseup=function(){
    document.onmousemove=null;
    oDiv.onmouseup=null;
    oDiv.releaseCapture &&oDiv.releaseCapture()
    }

    oDiv.setCapture &&oDiv.setCapture()
    return false
    }

    };

    </script>
    </head>

    <body>
    kkkkkkkkkkkkkkkkkkkkkkk
    <div id="div1"></div>
    ssssssssssssssssssssssssssssss
    </body>
    </html>

  • 相关阅读:
    QT中的列表容器
    QT中的Buttons
    QT中的常用控件
    [机房测试]弟娃
    CF1580C Train Maintenance
    [机房测试]数据恢复
    Sentry 监控
    Sentry 监控
    Sentry 监控
    Sentry 后端监控
  • 原文地址:https://www.cnblogs.com/heboliufengjie/p/4675064.html
Copyright © 2020-2023  润新知