Knowledge Base Nr: 00272 ajax8.txt - http://www.swe-kaiser.de
Downloads:
Ajax: simulated drag and drop (benutzt: tool von http://www.nczonline.net)
<head>
<title>Index</title>
<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"));
oDraggable.addDropTarget(oDropTarget);
oDropTarget.addEventListener("drop", function (oEvent) {
oEvent.relatedTarget.moveTo(oDropTarget.getLeft(), oDropTarget.getTop());
});
}
window.onload = function ()
{
doInit();
}
</script>
<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;
}
</style>
</head>
<body>
<p>Try dragging the red square onto the blue square.</p>
<div id="div1">div1</div>
<div id="divDropTarget">divDropTarget</div>
</body>
</html>