topical media & game development
professional-javascript-13-SystemDragAndDropExample7.htm / htm
<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.wrox.com" target="_blank">Wrox Home Page</a>
<div style="background-color: red; height: 100px; width: 100px"
ondragenter="handleDragDropEvent(event)"
ondragover="handleDragDropEvent(event)"
ondrop="handleDragDropEvent(event)"></div></p>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.