Knowledge Base Nr: 00272 ajax8.txt -


Ajax: simulated drag and drop (benutzt: tool von


<script type="text/javascript" src="zdragdroplib.js"></script>

<script type="text/javascript">

function doInit()
var oDraggable = new zDraggable(document.getElementById("div1")
, zDraggable.DRAG_X | zDraggable.DRAG_Y);
var oDropTarget = new zDropTarget(document.getElementById("divDropTarget"));
oDropTarget.addEventListener("drop", function (oEvent) {
oEvent.relatedTarget.moveTo(oDropTarget.getLeft(), oDropTarget.getTop());

window.onload = function ()


<style type="text/css">
#div1 {
background-color: red;
height: 100px;
width: 100px;
position: absolute;
z-index: 10;

#divDropTarget {
background-color: blue;
height: 200px;
width: 200px;
position: absolute;
left: 300px;

<p>Try dragging the red square onto the blue square.</p>
<div id="div1">div1</div>
<div id="divDropTarget">divDropTarget</div>