Get URL object from dataTransfer defined the Drag and drop event : Drag Drop Event « Drag Drop « JavaScript Tutorial






<html>
    <head>
        <title>System Drag And Drop Example</title>
        <script type="text/javascript">
            function handleDragDropEvent(oEvent) {

                switch(oEvent.type) {
                    case "dragover":
                    case "dragenter":
                        oEvent.returnValue = false;
                        break;
                    case "drop":
                        alert(oEvent.dataTransfer.getData("URL"));
                }
            }
        </script>
    </head>
    <body>
        <P>Try dragging the link to the red square.
        It will show you the URL when dropped.</p>
        <P><a href="http://www.java2s.com">www.java2s.com</a>
        <input type="text"
             ondragenter="handleDragDropEvent(event)"
             ondragover="handleDragDropEvent(event)"
             ondrop="handleDragDropEvent(event)"></div></p>

    </body>
</html>








24.1.Drag Drop Event
24.1.1.No drop target events fire
24.1.2.Drop target events fire now
24.1.3.Get text object from dataTransfer defined the Drag and drop event
24.1.4.Get URL object from dataTransfer defined the Drag and drop event
24.1.5.Get drag and drop event type: dragstart
24.1.6.Get drag and drop event type: dragenter
24.1.7.Get drag and drop event type: dragover
24.1.8.Get drag and drop event type: drop