simulateddraganddropexample.htm

来自「这是javascript高级程序设计的源码」· HTM 代码 · 共 27 行

HTM
27
字号
<html>
    <head>
        <title>Simulated Drag And Drop Example</title>
        <script type="text/javascript">
        
            function handleMouseMove(oEvent) {
                var oDiv = document.getElementById("div1");
                oDiv.style.left = oEvent.clientX;
                oDiv.style.top = oEvent.clientY;
            }
                                  
        </script>
        <style type="text/css">
            #div1 {
                background-color: red;
                height: 100px;
                width: 100px;
                position: absolute;
            }
        </style>
    </head>
    <body onmousemove="handleMouseMove(event)">
        <p>Try moving your mouse around.</p>
        <p><div id="div1"></div> </p>
    </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?