Mega Code Archive

 
Categories / JavaScript Tutorial / Drag Drop
 

Get drag and drop event type

< html>     <head>         <title>System Drag And Drop Example</title>         <script type="text/javascript">             function handleDragDropoEvent(oEvent) {                 switch(oEvent.type) {                     case "drop":                         oEvent.returnValue = false;                         oEvent.srcElement.innerHTML = oEvent.dataTransfer.getData("text");                 }             }         </script>     </head>     <body>         <P>Try dragging the text in the textbox to the right textbox.</p>         <P><input type="text" value="drag this text" ondragstart="handleDragDropoEvent(event)" />         <input ondragenter="handleDragDropoEvent(event)"                ondragover="handleDragDropoEvent(event)"                ondrop="handleDragDropoEvent(event)">         </input>         </p>     </body> </html>