systemdraganddropexample10.htm

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

HTM
25
字号
<html>
    <head>
        <title>System Drag And Drop Example</title>
        <script type="text/javascript">
        
            function handleMouseMove(oEvent) {
                if (oEvent.button == 1) {
                    oEvent.srcElement.dragDrop();
                }
            }
            
            function handleDragDropEvent(oEvent) {
                oEvent.dataTransfer.setData("text", "This is a red square");
            }                        
        </script>
    </head>
    <body>
        <p>Try dragging the red square into the textbox.</p>
        <p><div style="background-color: red; height: 100px; width: 100px"
                onmousemove="handleMouseMove(event)" 
                ondragstart="handleDragDropEvent(event)">This is a red square</div> </p>
        <p><input type="text" value="" /></p>
    </body>
</html>

⌨️ 快捷键说明

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