Get URL object from dataTransfer defined the Drag and drop event : Drag Drop Event : Drag Drop JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Drag Drop » Drag Drop Event »

 

Get URL object from dataTransfer defined the Drag and drop event

















<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.navioo.com">www.navioo.com</a>
        <input type="text"
             ondragenter="handleDragDropEvent(event)"
             ondragover="handleDragDropEvent(event)"
             ondrop="handleDragDropEvent(event)"></div></p>

    </body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Drag Drop
» Drag Drop Event